Bug 31792

Summary: gcc-2.96-69 generates code rejected by assembler
Product: [Retired] Red Hat Linux Reporter: Alan Peckham <20010226redhat>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED RAWHIDE QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0   
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-03-14 18:50:16 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 Alan Peckham 2001-03-14 18:50:13 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.76 [en] (Win98; U)


Optimized expression produces bad assembler code

Reproducible: Always
Steps to Reproduce:
1. source file follows
2.
3.
	

Actual Results:  $ cc -O /tmp/test.c
/tmp/cc6qpTmE.s: Assembler messages:
/tmp/cc6qpTmE.s:32: Error: `%al' not allowed with `cmpw'


Expected Results:  no errors...

typedef struct {
    int a[100];
    unsigned char b;
} a_t;

void load_a (a_t *a_p) {
    int i; for (i=0;i<100;i++) a_p->a[i]=i; a_p->b = 101;
}

void test_a (a_t *a_p, unsigned b) {
    if (((char) ((a_p->b) - (b))) < 0) a_p->b = b;
}

main () {
    a_t a;
    load_a(&a); test_a(&a,30);
}

Comment 1 Bill Nottingham 2001-03-14 19:33:29 UTC
Works fine for me with 2.96-78 and the current binutils.