[Bug rtl-optimization/75964] insn combiner removes comparison after ABS

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

Andrew Pinski  changed:

   What|Removed |Added

 CC||avr at gjlay dot de

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

[Bug rtl-optimization/75964] insn combiner removes comparison after ABS

2017-08-22 Thread gjl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=75964

--- Comment #11 from Georg-Johann Lay  ---
Author: gjl
Date: Tue Aug 22 10:07:51 2017
New Revision: 251271

URL: https://gcc.gnu.org/viewcvs?rev=251271=gcc=rev
Log:
gcc/
Backport from 2017-05-06 trunk r247719.
PR rtl-optimization/75964
* simplify-rtx.c (simplify_const_relational_operation): Remove
invalid handling of comparisons of integer ABS.
gcc/testsuite/
Backport from 2017-05-06 trunk r247719.
PR rtl-optimization/75964
* gcc.dg/torture/pr75964.c: New test.

Added:
branches/gcc-5-branch/gcc/testsuite/gcc.dg/torture/pr75964.c
Modified:
branches/gcc-5-branch/gcc/ChangeLog
branches/gcc-5-branch/gcc/simplify-rtx.c
branches/gcc-5-branch/gcc/testsuite/ChangeLog

[Bug rtl-optimization/75964] insn combiner removes comparison after ABS

2017-07-25 Thread gjl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=75964

Georg-Johann Lay  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
  Known to work||6.4.1, 7.1.1
 Resolution|--- |FIXED

--- Comment #10 from Georg-Johann Lay  ---
Fixed in v7.2 + v6.5.

[Bug rtl-optimization/75964] insn combiner removes comparison after ABS

2017-07-25 Thread gjl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=75964

--- Comment #9 from Georg-Johann Lay  ---
Author: gjl
Date: Tue Jul 25 11:55:44 2017
New Revision: 250511

URL: https://gcc.gnu.org/viewcvs?rev=250511=gcc=rev
Log:
gcc/
Backport from 2017-05-06 trunk r247719.
PR rtl-optimization/75964
* simplify-rtx.c (simplify_const_relational_operation): Remove
invalid handling of comparisons of integer ABS.
gcc/testsuite/
Backport from 2017-05-06 trunk r247719.
PR rtl-optimization/75964
* gcc.dg/torture/pr75964.c: New test.

Added:
branches/gcc-6-branch/gcc/testsuite/gcc.dg/torture/pr75964.c
Modified:
branches/gcc-6-branch/gcc/ChangeLog
branches/gcc-6-branch/gcc/simplify-rtx.c
branches/gcc-6-branch/gcc/testsuite/ChangeLog

[Bug rtl-optimization/75964] insn combiner removes comparison after ABS

2017-07-25 Thread gjl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=75964

Georg-Johann Lay  changed:

   What|Removed |Added

   Target Milestone|--- |7.2

[Bug rtl-optimization/75964] insn combiner removes comparison after ABS

2017-07-25 Thread gjl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=75964

--- Comment #8 from Georg-Johann Lay  ---
Author: gjl
Date: Tue Jul 25 11:39:23 2017
New Revision: 250509

URL: https://gcc.gnu.org/viewcvs?rev=250509=gcc=rev
Log:
gcc/
Backport from 2017-05-06 trunk r247719.
PR rtl-optimization/75964
* simplify-rtx.c (simplify_const_relational_operation): Remove
invalid handling of comparisons of integer ABS.
gcc/testsuite/
Backport from 2017-05-06 trunk r247719.
PR rtl-optimization/75964
* gcc.dg/torture/pr75964.c: New test.

Added:
branches/gcc-7-branch/gcc/testsuite/gcc.dg/torture/pr75964.c
Modified:
branches/gcc-7-branch/gcc/ChangeLog
branches/gcc-7-branch/gcc/simplify-rtx.c
branches/gcc-7-branch/gcc/testsuite/ChangeLog

[Bug rtl-optimization/75964] insn combiner removes comparison after ABS

2017-05-08 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=75964

--- Comment #7 from Richard Biener  ---
(In reply to rsand...@gcc.gnu.org from comment #5)
> Fixed on trunk.  It doesn't look like it's a regression, but maybe we want
> to backport anyway?

We usually backport wrong-code fixes to active branches if easily possible.

[Bug rtl-optimization/75964] insn combiner removes comparison after ABS

2017-05-08 Thread gjl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=75964

--- Comment #6 from Georg-Johann Lay  ---
(In reply to rsand...@gcc.gnu.org from comment #5)
> It doesn't look like it's a regression, but maybe we want to backport anyway?

Would be great.  It's wrong code after all, and the fix appears to be low
intrusive and without side effects.

[Bug rtl-optimization/75964] insn combiner removes comparison after ABS

2017-05-06 Thread rsandifo at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=75964

rsandifo at gcc dot gnu.org  changed:

   What|Removed |Added

 CC||rsandifo at gcc dot gnu.org

--- Comment #5 from rsandifo at gcc dot gnu.org  
---
Fixed on trunk.  It doesn't look like it's a regression, but maybe we want to
backport anyway?

[Bug rtl-optimization/75964] insn combiner removes comparison after ABS

2017-05-06 Thread rsandifo at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=75964

--- Comment #4 from rsandifo at gcc dot gnu.org  
---
Author: rsandifo
Date: Sat May  6 07:44:13 2017
New Revision: 247719

URL: https://gcc.gnu.org/viewcvs?rev=247719=gcc=rev
Log:
PR 75964: Invalid integer ABS handling in simplify-rtx.c

RTL has no distinction between signed and unsigned values, so it
doesn't make sense to test for signed overflow.

2017-05-06  Richard Sandiford  

gcc/
PR rtl-optimization/75964
* simplify-rtx.c (simplify_const_relational_operation): Remove
invalid handling of comparisons of integer ABS.

gcc/testsuite/
PR rtl-optimization/75964
* gcc.dg/torture/pr75964.c: New test.

Added:
trunk/gcc/testsuite/gcc.dg/torture/pr75964.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/simplify-rtx.c
trunk/gcc/testsuite/ChangeLog

[Bug rtl-optimization/75964] insn combiner removes comparison after ABS

2017-02-09 Thread ebotcazou at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=75964

--- Comment #3 from Eric Botcazou  ---
> So it's not only wrong code but also wrong diagnostic...

It's rather a consistent diagnostic, there could have been wrong code and no
diagnostic at all.

[Bug rtl-optimization/75964] insn combiner removes comparison after ABS

2017-02-09 Thread gjl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=75964

Georg-Johann Lay  changed:

   What|Removed |Added

   Keywords||diagnostic

--- Comment #2 from Georg-Johann Lay  ---
(In reply to Eric Botcazou from comment #1)
> > After pass .combine, the 2nd comparison is missing, presumably because
> > combiner invokes signed overflow on ABS which does not apply because all
> > computations are performed as unsigned.
> 
> Then you should have a warning with -Wstrict-overflow; this possibly comes
> from simplify-rtx.c:simplify_const_relational_operation in this case.

With -Wstrict-overflow=2 and avr-gcc-6.3 I get

warning: assuming signed overflow does not occur when assuming abs (x) >= 0 is
true [-Wstrict-overflow]

So it's not only wrong code but also wrong diagnostic...

[Bug rtl-optimization/75964] insn combiner removes comparison after ABS

2017-02-09 Thread ebotcazou at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=75964

Eric Botcazou  changed:

   What|Removed |Added

 CC||ebotcazou at gcc dot gnu.org

--- Comment #1 from Eric Botcazou  ---
> After pass .combine, the 2nd comparison is missing, presumably because
> combiner invokes signed overflow on ABS which does not apply because all
> computations are performed as unsigned.

Then you should have a warning with -Wstrict-overflow; this possibly comes from
simplify-rtx.c:simplify_const_relational_operation in this case.

[Bug rtl-optimization/75964] insn combiner removes comparison after ABS

2017-02-06 Thread gjl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=75964

Georg-Johann Lay  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2017-02-06
 Ever confirmed|0   |1