Browse Source

* fix alignment of ParamList
* fix test for architectures using aligned rtti

git-svn-id: trunk@42516 -

florian 6 years ago
parent
commit
1a67ffdd22
2 changed files with 6 additions and 1 deletions
  1. 4 1
      rtl/objpas/typinfo.pp
  2. 2 0
      tests/webtbs/tw12038.pp

+ 4 - 1
rtl/objpas/typinfo.pp

@@ -714,7 +714,10 @@ unit TypInfo;
             tkMethod:
               (MethodKind : TMethodKind;
                ParamCount : Byte;
-               ParamList : array[0..1023] of Char
+               case Boolean of
+                 False: (ParamList : array[0..1023] of Char);
+                 { dummy for proper alignment }
+                 True: (ParamListDummy : Word);
              {in reality ParamList is a array[1..ParamCount] of:
                   record
                     Flags : TParamFlags;

+ 2 - 0
tests/webtbs/tw12038.pp

@@ -281,6 +281,8 @@ begin
         v := 0;
         for i:= 1 to DTypeData^.ParamCount do
           begin
+           { due to the uncommon usage pattern, the alignment approach is uncommon as well }
+           Inc(CurrentParamPosition,AlignTParamFlags(@DTypeData^.ParamList[CurrentParamPosition])-@DTypeData^.ParamList[CurrentParamPosition]);
             { First Handle the ParamFlag }
            Flag:=pword(@DTypeData^.ParamList[CurrentParamPosition])^;
            Flags:=TParamFlags(Flag);