[Bug tree-optimization/96807] Division by zero produces zero with gcc -O2

2020-08-30 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96807

Andrew Pinski  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |INVALID

--- Comment #2 from Andrew Pinski  ---
>Instead of giving division by zero or infinity, it gives zero.

Is that even defined in Fortran, I think the answer is NO. so closing as
invalid.

[Bug tree-optimization/96807] Division by zero produces zero with gcc -O2

2020-08-26 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96807

--- Comment #1 from Richard Biener  ---
Division by zero is undefined behavior so we simplify 1/x to 0 if x is known
to be not one [unless there's literal 1/0 which is sometimes used to generate
traps].