[Bug tree-optimization/59413] [4.9 Regression] wrong code at -Os on x86_64-linux-gnu in both 32-bit and 64-bit modes
hjl.tools at gmail dot com
gcc-bugzilla@gcc.gnu.org
Fri Dec 20 12:39:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59413
H.J. Lu <hjl.tools at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |hjl.tools at gmail dot com
--- Comment #7 from H.J. Lu <hjl.tools at gmail dot com> ---
[hjl@gnu-mic-2 gcc-regression]$ cat pr59413.c
typedef unsigned int uint32_t;
uint32_t a;
int b;
int
main ()
{
uint32_t c;
for (a = 7; a <= 1; a++)
{
char d = a;
c = d;
b = a == c;
}
if (a != 7)
__builtin_abort ();
return 0;
}
[hjl@gnu-mic-2 gcc-regression]$
/export/project/git/gcc-regression/master/205883/usr/bin/gcc -S pr59413.c -Os
-o bad.s
[hjl@gnu-mic-2 gcc-regression]$
/export/project/git/gcc-regression/master/205887/usr/bin/gcc -S pr59413.c -Os
-o good.s
[hjl@gnu-mic-2 gcc-regression]$ diff -up bad.s good.s
--- bad.s 2013-12-20 04:38:57.810620352 -0800
+++ good.s 2013-12-20 04:39:12.476337299 -0800
@@ -8,20 +8,9 @@
main:
.LFB0:
.cfi_startproc
- movl b(%rip), %edx
- movl $7, %eax
-.L2:
- incl %eax
- cmpl $3, %eax
- je .L6
- movl $1, %edx
- jmp .L2
-.L6:
- pushq %rax
- .cfi_def_cfa_offset 16
- movl %edx, b(%rip)
- movl $2, a(%rip)
- call abort
+ movl $7, a(%rip)
+ xorl %eax, %eax
+ ret
.cfi_endproc
.LFE0:
.size main, .-main
@@ -31,5 +20,5 @@ main:
.LHOTE0:
.comm b,4,4
.comm a,4,4
- .ident "GCC: (GNU) 4.9.0 20131211 (experimental) [trunk revision
205883]"
+ .ident "GCC: (GNU) 4.9.0 20131211 (experimental) [trunk revision
205887]"
.section .note.GNU-stack,"",@progbits
[hjl@gnu-mic-2 gcc-regression]$
More information about the Gcc-bugs
mailing list