http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49335
--- Comment #1 from Michael Hope <michael.hope at linaro dot org> 2011-06-08 22:33:32 UTC --- Forgot the configuration: Configured with: '../../gcc-4.7~/configure' --prefix='/scratch/cbuild/slave/slaves/ursa3/gcc-4.7~svn174795/gcc/default/install' --enable-languages=c,c++,objc,obj-c++,fortran,lto --with-mode=thumb --with-arch=armv7-a --with-tune=cortex-a9 --with-float=softfp --with-fpu=neon Thread model: posix gcc version 4.7.0 20110608 (experimental) [trunk revision 174795] (GCC) michaelh@ursa2:~/linaro/bugs$ as -v GNU assembler version 2.20.51 (arm-linux-gnueabi) using BFD version (GNU Binutils for Ubuntu) 2.20.51-system.20100908 michaelh@ursa2:~/linaro/bugs$ uname -a Linux ursa2 2.6.35.3-cbuild2+ #8 SMP Mon Apr 4 12:46:46 NZST 2011 armv7l GNU/Linux michaelh@ursa2:~/linaro/bugs$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 10.10 Release: 10.10 Codename: maverick The fault also occurs at -O1 and -O3 but not at -O0. The assembly in the region is: .L33: movs r1, #0 movs r2, #64 mov r0, sp mov r9, sp bl memset cmp r4, #4 beq .L11 add r0, r8, r4, lsl #2 rsb r6, r8, #4 lsls r6, r6, #2 rsb r1, r4, #4 rsb r0, sp, r0, lsl #2 mov r4, sp mov lr, #0 which matches the final lines of the function. It looks like the code should be using r9 instead of sp.