https://gcc.gnu.org/g:35e1e59d818b8a8274c889532b020be36d014449

commit r17-1715-g35e1e59d818b8a8274c889532b020be36d014449
Author: Tamar Christina <[email protected]>
Date:   Sat Jun 20 09:42:59 2026 +0100

    testsuite: fix UB in vect-early-break_144-pr125804.c [PR125871]
    
    The PR reports a failure on -m32 that I can't seem to
    reproduce on my x86_64 machine..
    
    However cvise (I gave the compiler as many flags I
    could think of to prevent this) did give me a
    reproducer that has some UB in it wrt to signed
    shifts on 32-bit systems.
    
    So this fixed the UBs and hopefully that fixes
    the reported failure.
    
    gcc/testsuite/ChangeLog:
    
            PR testsuite/125871
            * gcc.dg/vect/vect-early-break_144-pr125804.c: New test.

Diff:
---
 gcc/testsuite/gcc.dg/vect/vect-early-break_144-pr125804.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/gcc/testsuite/gcc.dg/vect/vect-early-break_144-pr125804.c 
b/gcc/testsuite/gcc.dg/vect/vect-early-break_144-pr125804.c
index f8974023ee6a..d8deb733f70e 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-early-break_144-pr125804.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-early-break_144-pr125804.c
@@ -21,11 +21,11 @@ int g;
 __attribute__((noipa))
 int h(bitmap i) {
   c j = *i->d;
-  unsigned k, l = j.b < 4;
+  unsigned k = 0, l = j.b < 4;
   for (; l < 2; l++) {
     long long m = j.bits[l];
     for (; k < 64; k++) {
-      long long n = (long long)1LL << k;
+      long long n = (long long)(1ull << k);
       if (m & n)
         goto o;
     }
@@ -40,8 +40,8 @@ int main() {
 
   check_vect ();
 
-  c a;
-  a.bits[0] = 1ull << 63;
+  c a = { 4, { 0, 0 } };
+  a.bits[0] = -0x7fffffffffffffffLL - 1;
   f.d = &a;
   g = h(&f);
   return g == 0;

Reply via email to