[ forwarded from http://bugs.debian.org/219949 ] gcc-3.3.2 release: gcc -march=i386 -fomit-frame-pointer -O2 miscompiles sound/core/oss/rate.c in Linux 2.6.0-test9. I've attached the preprocessed source that demonstrates the problem. In the assembly output with -S, look for the 5th label in get_s16_labels.0. That label should do a word load, but instead it does a double word load: .L4: movl (%ebp), %eax jmp .L111
Created attachment 5131 [details] preprocessed source
On the mainline the asm looks like: movw (%edi), %ax movw %ax, (%esp)
Confirmed, GCC has no right to "promote" the memory access.
Fixing.
I think the bug is generic.
Subject: Bug 13041 CVSROOT: /cvs/gcc Module name: gcc Changes by: ebotcazou@gcc.gnu.org 2003-11-27 06:45:25 Modified files: gcc : ChangeLog final.c reload1.c Log message: PR optimization/13041 * final.c (frame_pointer_needed): Fix comment. * reload1.c (reload): Decrease alignment of the frame pointer if it was used for register allocation. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.1834&r2=2.1835 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/final.c.diff?cvsroot=gcc&r1=1.294&r2=1.295 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/reload1.c.diff?cvsroot=gcc&r1=1.413&r2=1.414
Subject: Bug 13041 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_3-branch Changes by: ebotcazou@gcc.gnu.org 2003-12-01 08:18:40 Modified files: gcc : ChangeLog final.c reload1.c Log message: Backport from mainline: 2003-11-27 Eric Botcazou <ebotcazou@libertysurf.fr> PR optimization/13041 * final.c (frame_pointer_needed): Fix comment. * reload1.c (reload): Decrease alignment of the frame pointer if it was used for register allocation. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.16114.2.812&r2=1.16114.2.813 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/final.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.271.2.1&r2=1.271.2.2 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/reload1.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.366.2.6&r2=1.366.2.7
See http://gcc.gnu.org/ml/gcc-patches/2003-11/msg01629.html