[Bug tree-optimization/101335] [12 Regression] wrong code at -O2 and above (casts between signed and unsigned) by r12-1796

2021-07-12 Thread amacleod at redhat dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101335

Andrew Macleod  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|NEW |RESOLVED

--- Comment #4 from Andrew Macleod  ---
fixed.

[Bug tree-optimization/101335] [12 Regression] wrong code at -O2 and above (casts between signed and unsigned) by r12-1796

2021-07-12 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101335

--- Comment #3 from CVS Commits  ---
The master branch has been updated by Andrew Macleod :

https://gcc.gnu.org/g:a1539b797a06e03b08e1f1de28ad0d19a3956616

commit r12-2258-ga1539b797a06e03b08e1f1de28ad0d19a3956616
Author: Andrew MacLeod 
Date:   Mon Jul 12 11:38:17 2021 -0400

Do not register a cast as an equivalence.

Registering an equivalence between objects of the same size in a cast can
cause other relations to be incorrect.

gcc/
PR tree-optimization/101335
* range-op.cc (operator_cast::lhs_op1_relation): Delete.

gcc/testsuite/
* gcc.dg/tree-ssa/pr101335.c: New.

[Bug tree-optimization/101335] [12 Regression] wrong code at -O2 and above (casts between signed and unsigned) by r12-1796

2021-07-12 Thread amacleod at redhat dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101335

--- Comment #2 from Andrew Macleod  ---
yeah, it because we have been treating casts to objects of the same precision
as equivalences.This normally works fine, but in this case we have
c_9 = (int)_2  c_9 == _2
_3 = c_9 - 10  so  _3 is < c_9
d_10 = (unsigned)_3d_10 == _3 

if (_2 < d_10)
with the equivalences, it now thinks that d_10 < _2.

So I have to either not allow compounding relations thru casting equivalences
(painful), or something else.

-fwrapv make its work because we don't register the relation _3 < c_9 if
wrapping is on.


I'm running an experiment... When the recomputation code was introduced, it
completely eliminated the need to track downcasts. It seems that removing all
equivalences between casts doesn't miss anything either, so perhaps this older
bit isn't needed anymore.

I'm running it thru the testsuite now...

[Bug tree-optimization/101335] [12 Regression] wrong code at -O2 and above (casts between signed and unsigned) by r12-1796

2021-07-06 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101335

Richard Biener  changed:

   What|Removed |Added

   Priority|P3  |P1

[Bug tree-optimization/101335] [12 Regression] wrong code at -O2 and above (casts between signed and unsigned)

2021-07-05 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101335

Andrew Pinski  changed:

   What|Removed |Added

 CC||pinskia at gcc dot gnu.org
Summary|wrong code at -O2 and above |[12 Regression] wrong code
   ||at -O2 and above (casts
   ||between signed and
   ||unsigned)
   Target Milestone|--- |12.0