[My first time at reporting, so please bear with me if I do something wrong...] The compiler outputs a bg branch instruction when it should use a bgu. The cause seems to be related to having a negative value in the enumeration. If I just comment out the DummyValue1 line, the code is correct. It does this at any optimization level of 1 or higher, and I haven't figured out if there is a specific optimization I can turn off as a work around. add %o0, -2, %o0 cmp %o0, 1 .stabn 68,0,13,.LLM3-_Z13DummyFunction10tTestEnum2 .LLM3: .stabn 68,0,15,.LLM4-_Z13DummyFunction10tTestEnum2 .LLM4: bg .LL2 mov 0, %o0 .stabn 68,0,16,.LLM5-_Z13DummyFunction10tTestEnum2 .LLM5: mov 2, %o0 .LL2: .LLBE3: .LLBE2: retl nop Thanks, Aaron Coleman Software Engineering Manager Lowrance Electronics, Inc. 12000 E Skelly Dr. Tulsa, OK 74128 918-437-6881 x8551
test.ii
Description: test.ii
Reading specs from /compilers/sparc-elf/lib/gcc/sparc-elf/3.4.0/specs Configured with: /gcc_src/gcc-3.4-20040317/configure --prefix=/compilers/sparc-elf --target=sparc-elf --enable-languages=c++ --with-newlib --enable-clocale=generic --enable-cxx-flags=-fno-exceptions --disable-hosted-libstdcxx Thread model: single gcc version 3.4.0 20040317 (prerelease) /compilers/sparc-elf/libexec/gcc/sparc-elf/3.4.0/cc1plus.exe -E -quiet -v -D__sparc_v8__ -D__sparc_v8__ test.cpp -mcpu=v8 -mcpu=v8 -mtune=v8 -mv8 -m32 -Werror -Wall -fworking-directory -O1 -o test.ii ignoring nonexistent directory "/compilers/sparc-elf/lib/gcc/sparc-elf/3.4.0/../../../../include/c++/3.4.0/backward" ignoring nonexistent directory "/compilers/sparc-elf/lib/gcc/sparc-elf/3.4.0/../../../../sparc-elf/sys-include" #include "..." search starts here: #include <...> search starts here: /compilers/sparc-elf/lib/gcc/sparc-elf/3.4.0/../../../../include/c++/3.4.0 /compilers/sparc-elf/lib/gcc/sparc-elf/3.4.0/../../../../include/c++/3.4.0/sparc-elf /compilers/sparc-elf/lib/gcc/sparc-elf/3.4.0/include /compilers/sparc-elf/lib/gcc/sparc-elf/3.4.0/../../../../sparc-elf/include End of search list. /compilers/sparc-elf/libexec/gcc/sparc-elf/3.4.0/cc1plus.exe -fpreprocessed test.ii -mcpu=v8 -quiet -dumpbase test.cpp -mcpu=v8 -mtune=v8 -mv8 -m32 -auxbase-strip test.o -g -O1 -Werror -Wall -version -o test.s GNU C++ version 3.4.0 20040317 (prerelease) (sparc-elf) compiled by GNU C version 3.3.1 (cygming special). GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 /compilers/sparc-elf/lib/gcc/sparc-elf/3.4.0/../../../../sparc-elf/bin/as.exe -V -Qy -s -o test.o test.s GNU assembler version 040202 (sparc-elf) using BFD version 040202 20040202