lawley@mullauna.cs.mu.oz.au (michael lawley) (05/23/89)
First the Encore specific bug (see below for machine/OS details). When compiled with gcc 1.34 or 1.35 _and_ optimisation, the following code: main() { int a=1; if(a) a++; if ( 2 == a) a++; } gives the assembler output: .file "s22.c" gcc_compiled.: .text .align 16 .globl _main _main: enter [],0 movl $2,f0 exit [] ret 0 which doesn't assemble due to the floating point register! Why a float register should be there I have no idea. Here is the output from gcc1.35: gcc -v -O gcc-bug.c gcc version 1.35 /nip/usr/lib/gcc-cpp -v -undef -D__GNUC__ -Dns32000 -Dn16 -Dns16000 -Dns32332 -Dunix -D__ns32000__ -D__n16__ -D__ns16000__ -D__ns32332__ -D__unix__ -D__OPTIMIZE__ gcc-bug.c /tmp/cc014955.cpp GNU CPP version 1.35 /nip/usr/lib/gcc-cc1 /tmp/cc014955.cpp -quiet -dumpbase gcc-bug.c -O -version -o /tmp/cc014955.s GNU C version 1.35 (32000, Encore syntax) compiled by GNU C version 1.35. as -j -o gcc-bug.o /tmp/cc014955.s Assembler: gcc-bug.c aline 8 : illegal operand The configuration is as follows: lrwxr-xr-x 1 lawley staff 15 May 17 15:11 md@ -> config/ns32k.md lrwxr-xr-x 1 lawley staff 18 May 17 15:11 tm.h@ -> config/tm-encore.h Machine is an Encore Multimax with 12 NS32032 processors running UMAX 4.2 Release R3.3.0 (bug was also there for R3.1.0) Also, if the second "a++" in the above code is changed to "return 2" (giving "if ( a == 2 ) return 2;") then the assembler output is: gcc -o /dev/tty -O -S gcc-bug2.c .file "gcc-bug2.c" gcc_compiled.: .text .align 16 .globl _main _main: enter [],0 movl $2,f0 cmpl f0,f0 bne .L3 movqd $2,r0 .L3: exit [] ret 0 Comparing a register with itself ! (Still with float register bug.) cheers, mike. /----------------------------------------------------\ | ACSnet: lawley@munnari.oz.au | | UUCP: {uunet,ukc,ubc-cs,mcvax}!munnari.oz!lawley | | ARPA: lawley%munnari.oz@uunet.uu.net | \----------------------------------------------------/