Browse Source

* fixed wrong class cast in case arrays/records are passed to a_loadfpu*()
(fixes tests/webtbs/tw26993.pp for llvm)

git-svn-id: trunk@34280 -

Jonas Maebe 9 years ago
parent
commit
f4015f6ac9
1 changed files with 12 additions and 4 deletions
  1. 12 4
      compiler/llvm/hlcgllvm.pas

+ 12 - 4
compiler/llvm/hlcgllvm.pas

@@ -1157,8 +1157,12 @@ implementation
          (since that's their storage size and internally they also are int64).
          (since that's their storage size and internally they also are int64).
          Solve this by changing the type to s80real once they are loaded into
          Solve this by changing the type to s80real once they are loaded into
          a register. }
          a register. }
-       fromcompcurr:=tfloatdef(fromsize).floattype in [s64comp,s64currency];
-       tocompcurr:=tfloatdef(tosize).floattype in [s64comp,s64currency];
+       fromcompcurr:=
+         (fromsize.typ=floatdef) and
+         (tfloatdef(fromsize).floattype in [s64comp,s64currency]);
+       tocompcurr:=
+         (tosize.typ=floatdef) and
+         (tfloatdef(tosize).floattype in [s64comp,s64currency]);
        if tocompcurr then
        if tocompcurr then
          tosize:=s80floattype;
          tosize:=s80floattype;
        { don't generate different code for loading e.g. extended into cextended,
        { don't generate different code for loading e.g. extended into cextended,
@@ -1194,8 +1198,12 @@ implementation
        tocompcurr: boolean;
        tocompcurr: boolean;
      begin
      begin
        { see comment in a_loadfpu_ref_reg }
        { see comment in a_loadfpu_ref_reg }
-       fromcompcurr:=tfloatdef(fromsize).floattype in [s64comp,s64currency];
-       tocompcurr:=tfloatdef(tosize).floattype in [s64comp,s64currency];
+       fromcompcurr:=
+         (fromsize.typ=floatdef) and
+         (tfloatdef(fromsize).floattype in [s64comp,s64currency]);
+       tocompcurr:=
+         (tosize.typ=floatdef) and
+         (tfloatdef(tosize).floattype in [s64comp,s64currency]);
        if fromcompcurr then
        if fromcompcurr then
          fromsize:=s80floattype;
          fromsize:=s80floattype;
        href:=make_simple_ref(list,ref,tosize);
        href:=make_simple_ref(list,ref,tosize);