Bug#472867: gcc-4.3: gcc regression in optimization (4.2 -> 4.3)
Package: gcc-4.3
Version: 4.3.0-2
Severity: grave
Justification: renders package unusable
gcc-4.3 forgets some checks in -O2 and -O3, tested on x86_64 and arm
(cross-compiler) targets.
the following is an exemple code with disassembled generated code by
gcc for 4.2 and 4.3 versions:
/* a.c */
int main()
{
register char (*foo)[32] = (void*)0xffff8000;
do {
asm volatile("mov %0, %0"::"r"(foo));
} while(++foo);
return (long)**foo;
}
/******* gcc 4.2 ********
* gcc-4.2 -c a.c -O2
* objdump -d a.o
a.o: file format elf64-x86-64
Disassembly of section .text:
0000000000000000 <main>:
0: b8 00 80 ff ff mov $0xffff8000,%eax
5: 48 89 c0 mov %rax,%rax
8: 48 83 c0 20 add $0x20,%rax
c: 75 f7 jne 5 <main+0x5>
e: 0f be 04 25 00 00 00 movsbl 0x0,%eax
15: 00
16: c3 retq
* arm-linux-gnueabi-gcc-4.2 -c a.c -O3
* arm-linux-gnueabi-objdump -d a.o
a.o: file format elf32-littlearm
Disassembly of section .text:
00000000 <main>:
0: e59f3010 ldr r3, [pc, #16] ; 18 <main+0x18>
4: e1a03003 mov r3, r3
8: e2933020 adds r3, r3, #32 ; 0x20
c: 1afffffc bne 4 <main+0x4>
10: e5d30000 ldrb r0, [r3]
14: e12fff1e bx lr
18: ffff8000 .word 0xffff8000
******* gcc 4.3 ********
* gcc-4.3 -c a.c -O2
* objdump -d a.o
a.o: file format elf64-x86-64
Disassembly of section .text:
0000000000000000 <main>:
0: b8 00 80 ff ff mov $0xffff8000,%eax
5: 0f 1f 00 nopl (%rax)
8: 48 89 c0 mov %rax,%rax
b: 48 83 c0 20 add $0x20,%rax
f: eb f7 jmp 8 <main+0x8>
* arm-linux-gnueabi-gcc-4.3 -c a.c -O3
* arm-linux-gnueabi-objdump -d a.o
a.o: file format elf32-littlearm
Disassembly of section .text:
00000000 <main>:
0: e59f3008 ldr r3, [pc, #8] ; 10 <main+0x10>
4: e1a03003 mov r3, r3
8: e2833020 add r3, r3, #32 ; 0x20
c: eafffffc b 4 <main+0x4>
10: ffff8000 .word 0xffff8000
*/
-- System Information:
Debian Release: lenny/sid
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.22-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages gcc-4.3 depends on:
ii binutils 2.18.1~cvs20080103-1 The GNU assembler, linker and bina
ii cpp-4.3 4.3.0-2 The GNU C preprocessor
ii gcc-4.3-base 4.3.0-2 The GNU Compiler Collection (base
ii libc6 2.7-8 GNU C Library: Shared libraries
ii libgcc1 1:4.3.0-2 GCC support library
ii libgomp1 4.3.0-2 GCC OpenMP (GOMP) support library
Versions of packages gcc-4.3 recommends:
ii libc6-dev 2.7-8 GNU C Library: Development Librari
-- no debconf information
Reply to: