https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99540
Alex Coplan <acoplan at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |acoplan at gcc dot gnu.org --- Comment #2 from Alex Coplan <acoplan at gcc dot gnu.org> --- So aarch64_add_offset has: /* Base the factor on LOW_BIT if we can calculate LOW_BIT directly, since that should increase the chances of being able to use a shift and add sequence. If LOW_BIT itself is out of range, just use CNTD. */ if (low_bit <= 16 * 8) factor /= low_bit; else low_bit = 1; val = gen_int_mode (poly_int64 (low_bit * 2, low_bit * 2), mode); val = aarch64_force_temporary (mode, temp1, val); if (can_create_pseudo_p ()) { rtx coeff1 = gen_int_mode (factor, mode); val = expand_mult (mode, val, coeff1, NULL_RTX, false, true); } and it's this call to expand_mult that fails. We're asking for a signed multiplication (unsignedp=false), we're not allowing libcalls (no_libcall=true), and we have -ftrapv. It appears that the expand code can't handle this (we would normally use a libcall here on aarch64). So I guess one option might be to punt to the else case if the expand_mult fails. An interesting question is whether we even want a trapping multiplication here? Is -ftrapv only meant to trap for multiplications that the user wrote or also those generated by the compiler?