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); }
Works fine for me with 2.96-78 and the current binutils.