c/8397: sh-coff-gcc-3.2

saito@densan.co.jp saito@densan.co.jp
Wed Oct 30 01:10:00 GMT 2002

>Number:         8397
>Category:       c
>Synopsis:       sh-coff-gcc-3.2
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Wed Oct 30 01:06:01 PST 2002
>Originator:     Hideo Saito
>Release:        gcc-3.2
NetBSD/PowerPC-1.5.2 gcc-3.0.3
If the size of the automatic variables becomes large when there is no flag specification of optimization, the code which accesses the variable which made a register declaration is wrong.

source code:
    len -= size;
generated assembler code:
        mov     #64,r2
        add     r14,r2
        mov     #64,r2
        add     r14,r2
        mov.l   @(4,r2),r1
        mov.l   @(8,r2),r2
        sub     r2,r1
        mov.l   r1,@(4,r2)
        bra     L2
compile: sh-coff-gcc -S fff.c
fff.c: see below

fff(len, size)
        register int len;
        register int size;
        char buf[58];
        char *ps;
        char *pe;

        while (len < size) {
                len -= size;


More information about the Gcc-bugs mailing list