Hi, I found something strange I don't understand, but I don't know if it's really a bug.
If I compile the following simple file x.cc: class A { public: A(); ~A(); int a(); }; class B { public: static int b(); }; int B::b() { A a; return a.a(); } I get the following assembler output for function B::b: with arm-linux-g++ -o x -g -O1 -fno-schedule-insns -fPIC -c x.cc int B::b() 0: e1a0c00d mov ip, sp 4: e92ddff0 stmdb sp!, {r4, r5, r6, r7, r8, r9, sl, fp, ip, lr, pc } 8: ed2d420c sfm f4, 4, [sp, #-48]! c: e24cb004 sub fp, ip, #4 ; 0x4 10: e24dd044 sub sp, sp, #68 ; 0x44 14: e59f30bc ldr r3, [pc, #188] ; d8 <.text+0xd8> 18: e7933003 ldr r3, [r3, r3] 1c: e50b3078 str r3, [fp, #-120] 20: e59f30b4 ldr r3, [pc, #180] ; dc <.text+0xdc> 24: e0833003 add r3, r3, r3 28: e50b3074 str r3, [fp, #-116] 2c: e24b3058 sub r3, fp, #88 ; 0x58 30: e50b3070 str r3, [fp, #-112] 34: e59f30a4 ldr r3, [pc, #164] ; e0 <.text+0xe0> 38: e0833003 add r3, r3, r3 3c: e50b306c str r3, [fp, #-108] 40: e50bd068 str sp, [fp, #-104] 44: e24b0090 sub r0, fp, #144 ; 0x90 48: ebfffffe bl 0 <_Unwind_SjLj_Register> with arm-linux-g++ -o x -g -O1 -fschedule-insns -fPIC -c x.cc: int B::b() 0: e1a0c00d mov ip, sp 4: e92ddff0 stmdb sp!, {r4, r5, r6, r7, r8, r9, sl, fp, ip, lr, pc } 8: ed2d420c sfm f4, 4, [sp, #-48]! c: e24cb004 sub fp, ip, #4 ; 0x4 10: e24dd044 sub sp, sp, #68 ; 0x44 14: e59f30bc ldr r3, [pc, #188] ; d8 <.text+0xd8> 18: e7921003 ldr r1, [r2, r3] 1c: e59f20b8 ldr r2, [pc, #184] ; dc <.text+0xdc> 20: e0822002 add r2, r2, r2 24: e59f30b4 ldr r3, [pc, #180] ; e0 <.text+0xe0> 28: e0823003 add r3, r2, r3 2c: e50b1078 str r1, [fp, #-120] 30: e50b3074 str r3, [fp, #-116] 34: e50b206c str r2, [fp, #-108] 38: e24b3058 sub r3, fp, #88 ; 0x58 3c: e50b3070 str r3, [fp, #-112] 40: e50bd068 str sp, [fp, #-104] 44: e24b0090 sub r0, fp, #144 ; 0x90 48: ebfffffe bl 0 <_Unwind_SjLj_Register> Now I get a segfault in 18: e7921003 ldr r1, [r2, r3] when I compare this to the -fno-schedule-insns case I think that this line should read: 18: e7921003 ldr r1, [r3, r3] which would yield the same result as with -fno-schedule-insns. Since I'm no scheduling expert, I don't know if this is a bug or just some arm weirdness. some info: arm-linux-uclibc-g++ -v Using built-in specs. Target: arm-linux-uclibc Configured with: /home/klimek/stuff/toolchains/st4000-gcc4.2/build/toolchain/buildroot2/toolchain_build_arm/gcc-4.2-20061007/configure --prefix=/home/klimek/stuff/toolchains/st4000-gcc4.2/toolchain --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c,c++ --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --enable-threads --disable-multilib --disable-libstdcxx-pch : (reconfigured) /home/klimek/stuff/toolchains/st4000-gcc4.2/build/toolchain/buildroot2/toolchain_build_arm/gcc-4.2-20061007/configure --prefix=/home/klimek/stuff/toolchains/st4000-gcc4.2/toolchain --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c,c++ --enable-shared --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-nls --enable-threads --disable-multilib --disable-libstdcxx-pch Thread model: posix gcc version 4.2.0 20061007 (experimental) arm-linux-uclibc-g++ -dumpmachine arm-linux-uclibc Cheers, Manuel