optimization/9962: Scheduling bug on i386
ksakamot@lsi.melco.co.jp
ksakamot@lsi.melco.co.jp
Wed Mar 5 07:27:00 GMT 2003
>Number: 9962
>Category: optimization
>Synopsis: Scheduling bug on i386
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: wrong-code
>Submitter-Id: net
>Arrival-Date: Wed Mar 05 07:16:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: ksakamot@lsi.melco.co.jp
>Release: 3.2.2
>Organization:
>Environment:
i686-pc-linux-gnu
>Description:
When the following source is compiled with "-O2 -fschedule-insns -fno-schedule-insns2", the scheduling is incorrect.
> gcc -S -O2 -fschedule-insns -fno-schedule-insns2 sched-bug.c
> cat sched-bug.s
.file "sched-bug.c"
.text
.p2align 4,,15
.globl func
.type func,@function
func:
pushl %ebp
movl %esp, %ebp
movzwl 12(%ebp), %edx
movl 8(%ebp), %eax
movw %dx, (%eax)
movl $0, (%eax)
popl %ebp
ret
.Lfe1:
.size func,.Lfe1-func
.ident "GCC: (GNU) 3.2.2"
"movl $0, (%eax)" is generated from "rr-code = code" and "movw %dx, (%eax)" is generated from "((unsigned long *)rr)[0] = 0;".
So "movw %dx, (%eax)" should be located after "movl $0, (%eax)".
>How-To-Repeat:
typedef struct r {
unsigned short code;
int a;
} ST;
void func( ST *rr, unsigned short code )
{
((unsigned long *)rr)[0] = 0;
rr->code = code;
}
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-bugs
mailing list