brad%cayman@HARVARD.HARVARD.EDU (Brad Parker) (01/02/89)
gcc 1.31 on a Sun 3/60 using SunOS 4.0; cross compiling for 68000 target. I've been having fairly good luck with "-O" and "-O -fcombine-regs -finline-functions -fstrength-reduce" (going for it ;-) except for the following bug. It seems that the branch type not correct; ---- func1() { } typedef unsigned long ulong; main() { int high_addr = 0; /* generates wrong branch with -O */ if ( (ulong)func1 > (ulong)0xfc0000 ) high_addr = 1; printf("func1 = %lx, high_addr = %d\n", (ulong)func1, high_addr); } ---- (gcc -c show.c) #NO_APP .text .even .globl _func1 _func1: link a6,#0 L1: unlk a6 rts LC0: .ascii "func1 = %lx, high_addr = %d\12\0" .even .globl _main _main: link a6,#-4 clrl a6@(-4) movel #16515072,d1 cmpl #_func1,d1 jcc L3 <--- correct, but not optimal moveq #1,d1 movel d1,a6@(-4) L3: movel a6@(-4),sp@- pea _func1 pea LC0 jbsr _printf L2: unlk a6 rts ----- (gcc -c -O show.c) #NO_APP .text .even .globl _func1 _func1: link a6,#0 unlk a6 rts LC0: .ascii "func1 = %lx, high_addr = %d\12\0" .even .globl _main _main: link a6,#0 clrl d0 movel #_func1+-16515072,d1 <--- better, jls L3 <--- but wrong branch type moveq #1,d0 L3: movel d0,sp@- pea _func1 pea LC0 jbsr _printf unlk a6 rts ---- -brad