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

Karl-Johan Karlsson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 31 01:11:50 PDT 2023


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG831b509d5f73: [builtins] Fix signed integer overflows in fp_fixint_impl.inc (authored by Ka-Ka).

Changed prior to commit:
  https://reviews.llvm.org/D159069?vs=554198&id=554928#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159069

Files:
  compiler-rt/lib/builtins/fp_fixint_impl.inc
  compiler-rt/test/builtins/Unit/fixsfdi_test.c


Index: compiler-rt/test/builtins/Unit/fixsfdi_test.c
===================================================================
--- compiler-rt/test/builtins/Unit/fixsfdi_test.c
+++ compiler-rt/test/builtins/Unit/fixsfdi_test.c
@@ -70,5 +70,8 @@
     if (test__fixsfdi(-0x1.FFFFFCp+62F, 0x8000010000000000LL))
         return 1;
 
-   return 0;
+    if (test__fixsfdi(-0x8000000000000000.0p+0F, 0x8000000000000000LL))
+        return 1;
+
+    return 0;
 }
Index: compiler-rt/lib/builtins/fp_fixint_impl.inc
===================================================================
--- compiler-rt/lib/builtins/fp_fixint_impl.inc
+++ compiler-rt/lib/builtins/fp_fixint_impl.inc
@@ -36,5 +36,5 @@
   if (exponent < significandBits)
     return sign * (significand >> (significandBits - exponent));
   else
-    return sign * ((fixint_t)significand << (exponent - significandBits));
+    return sign * ((fixuint_t)significand << (exponent - significandBits));
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D159069.554928.patch
Type: text/x-patch
Size: 948 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230831/32fe5f87/attachment.bin>


More information about the llvm-commits mailing list