bammi@DSRGSUN.CES.CWRU.EDU (Jwahar R. Bammi) (03/18/89)
Bug report for Gcc V1.34 (as distributed) -m68000 only (-m68020 OK) Configuration: (config.gcc sun3 (3/50, SunOS 3.5)) aux-output.c -> output-m68k.c config.h -> xm-m68k.h md -> m68k.md tm.h -> tm-sun3.h Compile Command: gcc -O -S bug.c -m68000 Sample Program that shows the bug: main() { char *s; s = "..."; if (s[2] != '.') { /* bug from here */ foo(); } } Assembly Output: #NO_APP gcc_compiled.: .text LC0: .ascii "...\0" .even .globl _main _main: link a6,#0 cmpb #46,LC0+2 <- bug here for m68000, LC0+2 is not a data alterable jeq L2 addressing mode. (OK on m68020 where data addressing jbsr _foo modes are allowed for second operand). L2: unlk a6 rts Explaination: The cmpb instruction on the m68000 allows only a data alterable addressing modes for the second operand. (On the m68020 data addressing modes are allowed, so the above example is OK). As illustraed above, gcc generates `LC0+2' for the second operand which is not a data alterable addressing mode, as LC0: is in the text segment (strings not being writable). I read and re-read Chapter 11 of the manual, but cannot see how to specify the correct constraint for this situation to the template in m68k.md for cmpqi. (BTW i was trying to run the code on a 68000 machine (AtariST) when i discovered this. The above example shows up the problem when trying to run s25() of the c-torture-test suite on a m68000 system). The cmpb instruction above, will generate an exception 4 (illegal instruction) on a m68000 system. -- usenet: {decvax,sun}!cwjcc!dsrgsun!bammi jwahar r. bammi csnet: bammi@dsrgsun.ces.CWRU.edu arpa: bammi@dsrgsun.ces.CWRU.edu compuServe: 71515,155