Parcourir la source

HPCC-14242 Constant-folding of external function calls could give wrong answer

Revealed only after refactoring the code in foldExternalCall (earlier in this
branch), the asm sections marshalling parameters were not correctly indicating
their clobber lists, which with some variants of gcc and in release-mode only
could result in the folded result being incorrect.

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman il y a 9 ans
Parent
commit
9ecd1e7934
1 fichiers modifiés avec 3 ajouts et 0 suppressions
  1. 3 0
      ecl/hql/hqlfold.cpp

+ 3 - 0
ecl/hql/hqlfold.cpp

@@ -969,6 +969,7 @@ IValue * doFoldExternalCall(IHqlExpression* expr, unsigned foldOptions, ITemplat
             ".floatdone: \n\t"
             : 
             : "S"(floatstack),"D"(floatSizes)
+            : "cc","xmm0","xmm1","xmm2","xmm3","xmm4","xmm5","xmm6","xmm7"
             );
         }           
         __asm__ (
@@ -987,6 +988,7 @@ IValue * doFoldExternalCall(IHqlExpression* expr, unsigned foldOptions, ITemplat
             "add    %%rbx, %%rsp \n\t" // Restore stack pointer (note have popped 6 registers)
             : "=a"(int64result),"=d"(dummy1),"=c"(dummy1),"=S"(dummy3),"=D"(dummy4)
             : "c"(len),"b"(len-REGPARAMS*REGSIZE),"S"(strbuf),"a"(fh)
+            : "cc","r8","r9","xmm0"
             );
         
         // Get real (float/double) return values;
@@ -1027,6 +1029,7 @@ IValue * doFoldExternalCall(IHqlExpression* expr, unsigned foldOptions, ITemplat
             "pop    %%ebx \n\t"
             : "=a"(intresult),"=d"(intresulthigh),"=c"(dummy1),"=S"(dummy2),"=D"(dummy3)
             : "c"(len),"S"(strbuf),"d"(fh)
+            : "cc"
             );
 
         // Get real (float/double) return values;