]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[PATCH] Restore bootstrap on aarch64
authorRoger Sayle <roger@nextmovesoftware.com>
Fri, 8 May 2026 13:39:13 +0000 (14:39 +0100)
committerRoger Sayle <roger@nextmovesoftware.com>
Fri, 8 May 2026 13:39:13 +0000 (14:39 +0100)
My recent change to synth_mult broke bootstrap on aarch64, as gimple's
array bounds checking pass reports a (false positive) problem in some
unreachable code.  This leads to -Werror stopping in stage2 of the
bootstrap.

The solution/workaround is add some more conditionals to the code that
make it clear(er) to range analysis the conditions under which the new
code is run.  I believe these tests are redundant, and hopefully will be
optimized by the compiler (if not now then at some point in the future).

This patch has been tested on an aarch64-apple-darwin24.3.0, where I was
able to reproduce the failure.  Committed to mainline as obvious (to
quickly resolve the current breakage).

2026-05-08  Roger Sayle  <roger@nextmovesoftware.com>

gcc/ChangeLog
* expmed.cc (synth_mult): Add more constraints to recent change
to avoid "false positive" array bounds warnings during bootstrap.

gcc/expmed.cc

index a75e406376a8f7fca27596e8ba37315c10334238..fe39506b6bde3a594867be37acfcf8aac2509d09 100644 (file)
@@ -2962,7 +2962,9 @@ synth_mult (struct algorithm *alg_out, unsigned HOST_WIDE_INT t,
                }
            }
        }
-      else if (GET_MODE_BITSIZE (imode) == 2 * BITS_PER_WORD
+      else if (2 * BITS_PER_WORD <= HOST_BITS_PER_WIDE_INT
+              && GET_MODE_BITSIZE (imode) == 2 * BITS_PER_WORD
+              && m >= BITS_PER_WORD
               && imode == mode)
        {
          q = t >> m;