[Bug rtl-optimization/106032] [10/11/12/13 Regression] wrong code at -Os and above on x86_64-linux-gnu
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Jun 20 15:09:10 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106032
--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
This one seems to be very old:
__attribute__((noipa, noinline, noclone)) int
foo (int x, int *y)
{
int a = 0;
if (x < 0)
a = *y;
return a;
}
int
main ()
{
int a = 42;
if (foo (0, 0) != 0 || foo (1, 0) != 0)
__builtin_abort ();
if (foo (-1, &a) != 42 || foo (-42, &a) != 42)
__builtin_abort ();
return 0;
}
I guess checking may_trap_p or may_trap_or_fault_p in noce_try_sign_mask would
fix this, but we probably should check other noce_* functions how they handle
possibly faulting memory.
More information about the Gcc-bugs
mailing list