diff --git a/rtl/objpas/typinfo.pp b/rtl/objpas/typinfo.pp index 68ed3e6b80..d6c4395291 100644 --- a/rtl/objpas/typinfo.pp +++ b/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; diff --git a/tests/webtbs/tw12038.pp b/tests/webtbs/tw12038.pp index 37556be15e..42edaa80f8 100644 --- a/tests/webtbs/tw12038.pp +++ b/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);