فهرست منبع

* fix for Mantis #35965: correct alignment also for the class info used to retrieve the unit name
+ added test

git-svn-id: trunk@42697 -

svenbarth 6 سال پیش
والد
کامیت
10af6fe2fb
3فایلهای تغییر یافته به همراه18 افزوده شده و 4 حذف شده
  1. 1 0
      .gitattributes
  2. 11 4
      rtl/inc/objpas.inc
  3. 6 0
      tests/webtbs/tw35965.pp

+ 1 - 0
.gitattributes

@@ -17787,6 +17787,7 @@ tests/webtbs/tw35937.pp svneol=native#text/plain
 tests/webtbs/tw3594.pp svneol=native#text/plain
 tests/webtbs/tw3595.pp svneol=native#text/plain
 tests/webtbs/tw35953.pp svneol=native#text/pascal
+tests/webtbs/tw35965.pp svneol=native#text/pascal
 tests/webtbs/tw3612.pp svneol=native#text/plain
 tests/webtbs/tw3617.pp svneol=native#text/plain
 tests/webtbs/tw3619.pp svneol=native#text/plain

+ 11 - 4
rtl/inc/objpas.inc

@@ -980,10 +980,17 @@
         type
           TClassTypeInfo = {$ifndef FPC_REQUIRES_PROPER_ALIGNMENT}packed{$endif}record
             Attributes: Pointer;
-            ClassType: TClass;
-            ParentInfo: Pointer;
-            PropCount: SmallInt;
-            UnitName: ShortString;
+            case TTypeKind of
+              tkClass: (
+                ClassType: TClass;
+                ParentInfo: Pointer;
+                PropCount: SmallInt;
+                UnitName: ShortString;
+              );
+              { include for proper alignment }
+              tkInt64: (
+                Dummy: Int64;
+              );
           end;
           PClassTypeInfo = ^TClassTypeInfo;
         var

+ 6 - 0
tests/webtbs/tw35965.pp

@@ -0,0 +1,6 @@
+program tw35965;
+
+begin
+  if TObject.UnitName <> 'System' then
+    Halt(1);
+end.