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.
}
}
}
- 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;