http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46715
Summary: template constructor - Compiler Bus error under -O2/-Os Product: gcc Version: 4.4.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: mgr.cl...@gmail.com GCC version and command line options can be found at the bottom. Preprocessed source as included breaks the compiler. Seems to be related to a templated class that requires padding There are 2 byte size members at the end of the class, when one is set in a constructor, and the other is accessed inside a loop, it fails to compiler under -O2/-Os The code compiles FINE under any one of the following conditions. If the CircleSprite constructor is declared inside the class definition. If the VertList<> constructor doesn't assign it's last member to false. If the VertList<> operator[] doesn't set boundVerts to false If inside the CircleSprite constructor, vertList is not accessed BEFORE the loop. If inside the CircleSprite constructor, vertList is not accessed INSIDE the loop. If inside the CircleSprite constructor, vertList is not accessed AFTER the loop. GCC VERSION: /android/android-ndk-r4b/build/prebuilt/darwin-x86/arm-eabi-4.4.0/bin/arm-eabi-g++ -v Using built-in specs. Target: arm-eabi Configured with: /tmp/xsrc/build/../gcc/gcc-4.4.0/configure --prefix=/tmp/xndk/build/prebuilt/darwin-x86/arm-eabi-4.4.0 --target=arm-eabi --host=i386-apple-darwin8.11.1 --build=i386-apple-darwin8.11.1 --enable-languages=c,c++ --with-gmp=/tmp/ndk-prebuilt-fS9/toolchain-arm-eabi-4.4.0/temp-install --with-mpfr=/tmp/ndk-prebuilt-fS9/toolchain-arm-eabi-4.4.0/temp-install --disable-libssp --enable-threads --disable-nls --disable-libmudflap --disable-libgomp --disable-libstdc__-v3 --disable-sjlj-exceptions --disable-shared --disable-tls --with-float=soft --with-fpu=vfp --with-arch=armv5te --enable-target-optspace --with-abi=aapcs --disable-nls --prefix=/tmp/xndk/build/prebuilt/darwin-x86/arm-eabi-4.4.0 --with-sysroot=/Volumes/Droid/ndk/ndk/build/platforms/android-3/arch-arm --with-binutils-version=2.19 --with-gcc-version=4.4.0 --with-gdb-version=6.6 --program-transform-name='s&^&arm-eabi-&' Thread model: single gcc version 4.4.0 (GCC) COMPILE COMMAND /Users/matthewclark/android/android-ndk-r4b/build/prebuilt/darwin-x86/arm-eabi-4.4.0/bin/arm-eabi-g++ -I/Users/matthewclark/android/android-ndk-r4b/build/platforms/android-8/arch-arm/usr/include -fpic -mthumb-interwork -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -Wno-psabi -march=armv5te -mtune=xscale -msoft-float -fno-exceptions -fno-rtti -O2 -save-temps -Wa,--noexecstack -c -MMD -MP -MF /Perforce/branches/Trains/android/obj/local/armeabi/objs/VoxelEngine/../../Source/Graphics/CircleSprite.o.d /Perforce/branches/Trains/android/jni/../../Source/Graphics/CircleSprite.cpp -o /Perforce/branches/Trains/android/obj/local/armeabi/objs/VoxelEngine/../../Source/Graphics/CircleSprite.o THE ERROR: /Perforce/branches/Trains/android/jni/../../Source/Graphics/CircleSprite.cpp: In constructor 'Graphics::CircleSprite::CircleSprite()': /Perforce/branches/Trains/android/jni/../../Source/Graphics/CircleSprite.cpp:118: internal compiler error: Bus error Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions.