[Bug tree-optimization/46315] [4.5 Regression] gcc-4.5.1 -O2 -fno-strict-overflow causes bad code generation
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46315 --- Comment #4 from Richard Guenther 2010-11-12 14:56:54 UTC --- loop-header copying is where things start to be different. In the end the asm doesn't make much sense: parse_ranged.clone.0: .LFB2: .cfi_startproc leaq2(%rdi), %rdx movq%rdi, %rax ... leal(%rdx,%rdx,4), %edx movb$2, %al leal(%rcx,%rdx,2), %edx .L2: testq %rax, %rax je .L7 cmpl$60, %edx movl$0, %edx cmovge %rdx, %rax ret so we might end up returning literal 2. Reduced testcase: static char const * parse_ranged (char const *s, int digits) { int n = 0; char const *lim = s + digits; while (s < lim) { unsigned d = *s++ - '0'; if (9 < d) return 0; n = 10 * n + d; } return s && 0 <= n && n <= 59 ? s : 0; } extern void abort (void); int main() { const char *s = "10092240"; s = parse_ranged (s, 2); s = parse_ranged (s, 2); s = parse_ranged (s, 2); s = parse_ranged (s, 2); if (!s || *s != '\0') abort(); return 0; }
[Bug tree-optimization/46315] [4.5 Regression] gcc-4.5.1 -O2 -fno-strict-overflow causes bad code generation
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46315 Ryan Hill changed: What|Removed |Added CC||dirtyepic at gentoo dot org --- Comment #3 from Ryan Hill 2010-11-09 04:49:54 UTC --- Not to rush you, but I was wondering if there will be anyone looking at this in the near future. I was planning on releasing 4.5.1 into the unstable branch of our repo this week but if a patch may be soon available I'll hold off. If there isn't any interest I'll do the release and mask it on our hardened profiles (which use -fno-strict-overflow by default) for now.
[Bug tree-optimization/46315] [4.5 Regression] gcc-4.5.1 -O2 -fno-strict-overflow causes bad code generation
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46315 --- Comment #2 from Richard Guenther 2010-11-05 16:47:12 UTC --- ipa-cp triggers this but is not neccessarily at fault. Workaround: -fno-ipa-cp.
[Bug tree-optimization/46315] [4.5 Regression] gcc-4.5.1 -O2 -fno-strict-overflow causes bad code generation
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46315 Richard Guenther changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed||2010.11.05 16:43:32 Known to work||4.4.4, 4.6.0 Target Milestone|--- |4.5.2 Summary|gcc-4.5.1 -O2 |[4.5 Regression] gcc-4.5.1 |-fno-strict-overflow causes |-O2 -fno-strict-overflow |bad code generation |causes bad code generation Ever Confirmed|0 |1 Known to fail||4.5.0, 4.5.1 --- Comment #1 from Richard Guenther 2010-11-05 16:43:32 UTC --- Confirmed.