[Bug middle-end/108789] __builtin_(add|mul)_overflow methods generate duplicate operations if both operands are const which in turn causes wrong code due to overlapping arguments

2024-06-03 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108789

Andrew Pinski  changed:

   What|Removed |Added

 CC||cody at tapscott dot me

--- Comment #3 from Andrew Pinski  ---
*** Bug 115326 has been marked as a duplicate of this bug. ***

[Bug middle-end/108789] __builtin_(add|mul)_overflow methods generate duplicate operations if both operands are const which in turn causes wrong code due to overlapping arguments

2023-11-08 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108789

Andrew Pinski  changed:

   What|Removed |Added

Summary|__builtin_(add|mul)_overflo |__builtin_(add|mul)_overflo
   |w methods generate  |w methods generate
   |duplicate operations if |duplicate operations if
   |both operands are const |both operands are const
   ||which in turn causes wrong
   ||code due to overlapping
   ||arguments
 Ever confirmed|0   |1
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2023-11-09

--- Comment #2 from Andrew Pinski  ---
Confirmed.

The obvious workaround is to use a temporary variables for the arguments of
__builtin_add_overflow .

[Bug middle-end/108789] __builtin_(add|mul)_overflow methods generate duplicate operations if both operands are const

2023-02-14 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108789

Andrew Pinski  changed:

   What|Removed |Added

  Component|c   |middle-end

--- Comment #1 from Andrew Pinski  ---
The middle-end is not adding a SAVE_EXPR in the const case which causes the
duplication which is not optimized back.