Переглянути джерело

* fix for mantis #22796: add alignment padding to records before inserting
hidden parameters while parsing the interface, because they may depend on
the padded size (since the size was not yet padded in the interface and
padded in the implementation, this could result in differences)

git-svn-id: trunk@22414 -

Jonas Maebe 13 роки тому
батько
коміт
64740049bf
2 змінених файлів з 5 додано та 2 видалено
  1. 3 2
      compiler/ptype.pas
  2. 2 0
      tests/webtbs/tw22796.pp

+ 3 - 2
compiler/ptype.pas

@@ -822,12 +822,13 @@ implementation
                add_typedconst_init_routine(current_structdef);
                add_typedconst_init_routine(current_structdef);
              consume(_END);
              consume(_END);
             end;
             end;
+         { make the record size aligned (has to be done before inserting the
+           parameters, because that may depend on the record's size) }
+         recst.addalignmentpadding;
          { don't keep track of procdefs in a separate list, because the
          { don't keep track of procdefs in a separate list, because the
            compiler may add additional procdefs (e.g. property wrappers for
            compiler may add additional procdefs (e.g. property wrappers for
            the jvm backend) }
            the jvm backend) }
          insert_record_hidden_paras(trecorddef(current_structdef));
          insert_record_hidden_paras(trecorddef(current_structdef));
-         { make the record size aligned }
-         recst.addalignmentpadding;
          { restore symtable stack }
          { restore symtable stack }
          symtablestack.pop(recst);
          symtablestack.pop(recst);
          if trecorddef(current_structdef).is_packed and is_managed_type(current_structdef) then
          if trecorddef(current_structdef).is_packed and is_managed_type(current_structdef) then

+ 2 - 0
tests/webtbs/tw22796.pp

@@ -1,3 +1,5 @@
+{ %norun }
+
 program CompileError;
 program CompileError;
 
 
 {$mode delphi}{$H+}
 {$mode delphi}{$H+}