We have encountered what seems to be a gcc bug in the attempt to upgrade our toolchain (using buildroot, embedded ARM no-MMU CPU) from 3.4.6 to 4.2.x. The bug has been seen on both 4.2.3 and 4.2.4. We have not yet been able to build a toolchain based on gcc 4.3.1. Most of our +5 MB system runs fine, but some strange problems we had boiled down to the attached test programs which essentially deals with passing some int parms and a struct through two function calls. The test code fails when executed on the ARM target. It works on x86 using gcc 4.2.3 and also on a MIPS platform using gcc 4.2.1.
The test code only fails with -O2. Compiled using: [EMAIL PROTECTED]:~/src/kuss/tmp$ /home/bla/src/kuss/bs/toolchain/linux24/usr/bin/arm-elf-gcc -save-temps -c -Wall -Werror -O2 -g -Wa,-W -o .o/arm4/test.o test.c [EMAIL PROTECTED]:~/src/kuss/tmp$ /home/bla/src/kuss/bs/toolchain/linux24/usr/bin/arm-elf-g++ -save-temps -c -Wall -Werror -O2 -g -Wa,-W -o .o/arm4/testcpp.o testcpp.cpp Output from the C test run on target: :/> /bin/test ### C test: Values before test: 1 2 3 4 ### FAILS: 0x00000001 0x00000002 0x00000004 0x00000004 ### OK Output from the C++ test run on target: :/> /bin/testcpp ### C++ test: Values before test: 1 2 3 4 ### FAILS: 0x00000001 0x00000002 0x00000004 0x00000004 ### OK [EMAIL PROTECTED]:~/src/kuss/tmp$ ../bs/toolchain/linux24/usr/bin/arm-elf-gcc -v Using built-in specs. Target: arm-linux-uclibc Configured with: /home/bla/src/kuss/opensrc/gpl/toolchains/arm-gcc4/toolchain_build_arm/gcc-4.2.4/configure --prefix=/usr --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-linux-uclibc --enable-languages=c,c++ --with-sysroot=/home/bla/src/kuss/bs/toolchain/linux24 --with-build-time-tools=/home/bla/src/kuss/bs/toolchain/linux24/usr/arm-linux-uclibc/bin --disable-__cxa_atexit --enable-target-optspace --with-gnu-ld --disable-libgomp --disable-libmudflap --disable-shared --with-gmp=/home/bla/src/kuss/opensrc/gpl/toolchains/arm-gcc4/toolchain_build_arm/gmp --with-mpfr=/home/bla/src/kuss/opensrc/gpl/toolchains/arm-gcc4/toolchain_build_arm/mpfr --disable-nls --enable-threads --disable-multilib --with-float=soft --with-arch=armv4 --with-tune=arm7tdmi Thread model: posix gcc version 4.2.4 -- Summary: gcc 4.2.x generates wrong code for ARM target Product: gcc Version: 4.2.4 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: benny at ammitzboell-consult dot dk GCC build triplet: i386-pc-linux-gnu GCC host triplet: i386-pc-linux-gnu GCC target triplet: arm-linux-uclibc http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36527