Bug 37054

Summary: GCC optimizer bug; miscompiles kernel sym53c8xx driver
Product: [Retired] Red Hat Linux Reporter: Krzysztof Halasa <khalasa>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED RAWHIDE QA Contact: David Lawrence <dkl>
Severity: high Docs Contact:
Priority: medium    
Version: 7.1   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2001-04-22 19:03:30 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Krzysztof Halasa 2001-04-22 14:38:44 UTC
gcc-2.96-81 -O2 miscompiles the attached code. RedHat 7.1 sym53c8xx SCSI
driver is affected, on my system (Tekram 53C860) RH7.1 install program
causes "oops" (non-fatal, but you can't access SCSI) when insmoding
sym53c8xx.o.

Reproducible: Always
Steps to Reproduce:
1. install Tekram 310U (or possibly other NCR53C8xx-based) SCSI PCI card
2. run RH7.1 install from CD
3. watch the screen


Actual Results:  $ gcc -O2 test.c -o test
$ ./test
x = 0 (should be 8)

int main(void)
{
        unsigned int x = 8;
        if (x < 5)
                x =  4;
        else
                x =  8;

        printf("x = %u (should be 8)\n", x);
}
I haven't tested current gcc compilers, possibly the problem should be
corrected there as well.

Comment 1 Jakub Jelinek 2001-04-22 18:26:41 UTC
Verified, looks like a bug in ia32's ix86_expand_int_movcc,
happens in gcc 3.0 and gcc 3.1 as well.
Hope to have this debugged by tomorrow.

Comment 2 Jakub Jelinek 2001-04-22 19:03:25 UTC
Fixed by http://gcc.gnu.org/ml/gcc-patches/2001-04/msg01057.html
and will be included in the upcoming gcc-2.96-82.

Comment 3 Matt Wilson 2001-05-09 03:24:15 UTC
*** Bug 39764 has been marked as a duplicate of this bug. ***