https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114700
--- Comment #9 from Richard Biener ---
That that GCC doesn't promise that -ftrapv preserves all overflows and traps,
it merely guarantees that all overflows that actually happen trap. So GCC is
fine to contract some expressions where the overal
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114700
--- Comment #8 from lin1.hu at intel dot com ---
(In reply to Andrew Pinski from comment #6)
> Note `c - y - c` to become `-y` reduces the possible of an overflow and is
> well defined for wrapping so this might be still on purpose as there wil
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114700
--- Comment #7 from lin1.hu at intel dot com ---
(In reply to Andrew Pinski from comment #5)
> From match.pd:
> /* Match patterns that allow contracting a plus-minus pair
> irrespective of overflow issues. */
> /* (A +- B) - A ->
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114700
Andrew Pinski changed:
What|Removed |Added
See Also||https://gcc.gnu.org/bugzill
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114700
--- Comment #5 from Andrew Pinski ---
>From match.pd:
/* Match patterns that allow contracting a plus-minus pair
irrespective of overflow issues. */
/* (A +- B) - A -> +- B */
/* (A +- B) -+ B -> A */
/* A - (A +- B)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114700
--- Comment #4 from Andrew Pinski ---
int z;
void func(int a, int b, int c, int y){
z = c - y - c + a + y - b;
}
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114700
--- Comment #3 from lin1.hu at intel dot com ---
(In reply to lin1.hu from comment #2)
> (In reply to Andrew Pinski from comment #1)
> > Gcc's trapv is known not always to work correctly.
> >
> > Try -fsanitize=undefined instead.
Thanks, it sol
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114700
--- Comment #2 from lin1.hu at intel dot com ---
(In reply to Andrew Pinski from comment #1)
> Gcc's trapv is known not always to work correctly.
>
> Try -fsanitize=undefined instead.
Thanks, it solves the problem to some extent. But c is elimi
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114700
--- Comment #1 from Andrew Pinski ---
Gcc's trapv is known not always to work correctly.
Try -fsanitize=undefined instead.