[PATCH] D159069: [builtins] Fix signed integer overflows in fp_fixint_impl.inc

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 30 17:58:08 PDT 2023


MaskRay accepted this revision.
MaskRay added inline comments.
This revision is now accepted and ready to land.


================
Comment at: compiler-rt/lib/builtins/fp_fixint_impl.inc:39
   else
-    return sign * ((fixint_t)significand << (exponent - significandBits));
+    return sign * ((fixuint_t)significand << (exponent - significandBits));
 }
----------------
Looks ok.


================
Comment at: compiler-rt/test/builtins/Unit/fixsfdi_test.c:73
 
-   return 0;
+    if (test__fixsfdi(-0x8000000000000000.0p+0F, 0x8000000000000000LL))
+      return 1;
----------------
Ka-Ka wrote:
> The added test pass when compiling with gcc -lgcc.
> 
This checks the `__fixunssfdi` code path, not `fp_fixint_impl.inc`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D159069/new/

https://reviews.llvm.org/D159069



More information about the llvm-commits mailing list