Bladeren bron

* encode the result type of functions returning a zero-sized value
using their actual type (array/record) rather than using the
simplified type (void), so we can also return an actual value and
assign it to something (void means that nothing is returned and
cannot be assigned to anything) (completes fixing
tests/test/tnoext4.pp for llvm)

git-svn-id: trunk@34120 -

Jonas Maebe 9 jaren geleden
bovenliggende
commit
0cce590982
1 gewijzigde bestanden met toevoegingen van 7 en 2 verwijderingen
  1. 7 2
      compiler/llvm/llvmdef.pas

+ 7 - 2
compiler/llvm/llvmdef.pas

@@ -856,8 +856,13 @@ implementation
         { single location }
         { single location }
         if not assigned(cgpara.location^.next) then
         if not assigned(cgpara.location^.next) then
           begin
           begin
-            { def of the location, except in case of zero/sign-extension }
-            usedef:=cgpara.location^.def;
+            { def of the location, except in case of zero/sign-extension and
+              zero-sized records }
+            if not is_special_array(cgpara.def) and
+               (cgpara.def.size=0) then
+              usedef:=cgpara.def
+            else
+              usedef:=cgpara.location^.def;
             if beforevalueext then
             if beforevalueext then
               llvmextractvalueextinfo(cgpara.def,usedef,valueext);
               llvmextractvalueextinfo(cgpara.def,usedef,valueext);
             { comp and currency are handled by the x87 in this case. They cannot
             { comp and currency are handled by the x87 in this case. They cannot