Browse Source

* use tabstractrecordsymtable.has_single_field() to determine whether a
record has only a single field (and if so, which one) when checking
whether we have to treat the record as if it was actually its first
field that's passed as a parameter (fixes problems with records
with methods, e.g. crash while compiling tests/test/trhlp35)

git-svn-id: trunk@20967 -

Jonas Maebe 13 years ago
parent
commit
5dac788b71
1 changed files with 6 additions and 5 deletions
  1. 6 5
      compiler/powerpc64/cpupara.pas

+ 6 - 5
compiler/powerpc64/cpupara.pas

@@ -287,6 +287,7 @@ function tppcparamanager.create_paraloc_info_intern(p: tabstractprocdef; side:
   var curintreg, curfloatreg, curmmreg: tsuperregister; var cur_stack_offset:
   aword; isVararg : boolean): longint;
 var
+  fsym: tfieldvarsym;
   stack_offset: longint;
   paralen: aint;
   nextintreg, nextfloatreg, nextmmreg : tsuperregister;
@@ -350,11 +351,11 @@ begin
         { if a record has only one field and that field is }
         { non-composite (not array or record), it must be  }
         { passed according to the rules of that type.       }
-        if (trecorddef(hp.vardef).symtable.SymList.count = 1) and
-          (not trecorddef(hp.vardef).isunion)  and
-          (tabstractvarsym(trecorddef(hp.vardef).symtable.SymList[0]).vardef.typ in [orddef, enumdef, floatdef])  then begin
-          paradef :=
-            tabstractvarsym(trecorddef(hp.vardef).symtable.SymList[0]).vardef;
+        if tabstractrecordsymtable(tabstractrecorddef(hp.vardef).symtable).has_single_field(fsym) and
+          ((fsym.vardef.typ = floatdef) or
+           (not(target_info.system in systems_aix) and
+            (fsym.vardef.typ in [orddef, enumdef]))) then begin
+          paradef := fsym.vardef;
           loc := getparaloc(paradef);
           paracgsize := def_cgsize(paradef);
         end else begin