http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48576
Summary: wrong code when accessing variables in a large stack frame Product: gcc Version: 4.5.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassig...@gcc.gnu.org ReportedBy: akos.paszt...@gmail.com Target: arm-linux-gnueabi Created attachment 23964 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23964 preprocessed source Tried with 4.5.2 (and 4.6.0), stage1 compiler: ../gcc-4.5.2/configure \ --target=arm-linux-gnueabi \ --disable-shared \ --disable-bootstrap \ --with-sysroot=/usr/arm-linux-gnueabi \ --disable-threads \ --disable-libmudflap \ --disable-libssp \ --with-arch=armv7-a --with-tune=cortex-a8 --with-float=hard --with-fpu=neon \ --enable-languages=c \ --with-newlib When compiling the attached source with: ./cc1 -O1 -fgcse -fno-omit-frame-pointer jaj.i gcc produces this code to do "arr[n] = strdup(str)": ... bl strdup sub r3, fp, #4096 ldr r3, [r3, #-132] @ this kills r3 ldr r2, [r3, #-128] @ and this doesn't know about it str r0, [r2, r3, asl #2] ... The problem is first visible in jaj.i.192r.ira when using -fdump-rtl-all. Omitting frame pointer "helps" but I think it's pure coincidence. Apologies about the messy test code but I was not able to reduce it more without changing the output.