gcc 2.7.2.1 optimizer bug?
Art Berggreen
art@acc.com
Thu Mar 12 14:07:00 GMT 1998
>
>Here it goes (note the lines with '!!!!!!!!!!!'):
>
>$ cat t.c
>static unsigned long *bar = 0; /* should be ptr to 32 bit on m68k */
>
>void foo (void)
>{
> if (bar && *bar) (*bar)--;
>}
>$ m68k-coff-gcc -v
>Reading specs from /usr/local/m68k-emb/lib/gcc-lib/m68k-coff/2.7.2.1/specs
>gcc version 2.7.2.1
>$ m68k-coff-gcc -S -O1 -ansi -m68332 -fomit-frame-pointer -fforce-mem t.c
>$ cat t.s
> .file "t.c"
>gcc2_compiled.:
>__gnu_compiled_c:
>.data
> .even
>bar:
> .long 0
>.text
> .even
>.globl foo
>foo:
> move.l bar,%a0
> tst.l %a0
> jbeq .L2
> move.l (%a0),%a1
> tst.l %a1
> jbeq .L2
> subq.w #1,%a1
> /* ^ note the size spezifier here 16 bit !!!!!!!!!!!!!! */
Arithmetic operations on 68k address registers are always promoted to
32 bits.
Art
More information about the crossgcc
mailing list