14478 – [3.3 only] rs6000 geu/ltu patterns generate incorrect code (original) (raw)
Description Alan Modra 2004-03-08 10:00:03 UTC
Compiling the following with -O results in a function that always returns zero, instead of one that always returns 1.
int foo (int a, unsigned int x) { unsigned int n = 0;
while (a) x = x + 1, a = a << 1;
return x >= n; }
Comment 1 Alan Modra 2004-03-08 10:01:33 UTC
Fixing
Comment 3 Drea Pinski 2004-03-09 03:41:47 UTC
This is fixed on the tree-ssa because of constant propagation.
Comment 4 Alan Modra 2004-03-09 04:10:22 UTC
Could you perhaps tickle the bug on tree-ssa with a different testcase?
Note that on mainline, the problem insns are generated by combine.
Comment 5 Drea Pinski 2004-03-09 04:15:34 UTC
You almost cannot as it will constant fold "unsigned >= 0" always before even getting to the RTL.
Comment 7 Drea Pinski 2004-05-26 12:29:43 UTC
Newest patch to reject the RTL patterns from being made in the first place: <http://gcc.gnu.org/ml/ gcc-patches/2004-05/msg01669.html>
Comment 10 Alan Modra 2004-05-27 07:45:28 UTC
Fixed on 3.4 and head.