https://gcc.gnu.org/g:8a17f707c90ea92271c9a52846f9be5ca24c6c5a

commit r17-408-g8a17f707c90ea92271c9a52846f9be5ca24c6c5a
Author: Roger Sayle <[email protected]>
Date:   Fri May 8 14:39:13 2026 +0100

    [PATCH] Restore bootstrap on aarch64
    
    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  <[email protected]>
    
    gcc/ChangeLog
            * expmed.cc (synth_mult): Add more constraints to recent change
            to avoid "false positive" array bounds warnings during bootstrap.

Diff:
---
 gcc/expmed.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gcc/expmed.cc b/gcc/expmed.cc
index a75e406376a8..fe39506b6bde 100644
--- a/gcc/expmed.cc
+++ b/gcc/expmed.cc
@@ -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;

Reply via email to