Tue 26 Apr 2005 03:37:10 PM UTC, original submission:
I don't know if you would call this broken optimization or other bug.
Gcc is treating the unsigned char as 16 bits. The problem did not exist in release 2.2.
int main(void);
unsigned char c;
int main()
{
if ( (c & 0x01) == 0) {
return 1;
}
return 0;
}
/usr/local/bin/gcc-m6811-x/m6811-elf-gcc -c -I. -I../../../gel/include/asm-m68hc12/arch-dragon12 -I../../../gel/include -m68hc12 -mshort -Wall -Wmissing-prototypes -g -Os -o err2.o err2.c
if ( (vPortCCRSave & 0x10) == 0)
44fa: f6 18 51 ldab 1851 <vPortCCRSave>
44fd: c4 10 andb #16
44ff: 26 02 bne 4503 <.LM73>
- The same block compiled by release 3.0 ***
if ( (vPortCCRSave & 0x10) == 0)
4558: f6 18 be ldab 18be <vPortCCRSave>
455b: 84 00 anda #0
455d: c4 10 andb #16
455f: 04 64 02 tbne D,4564 <.LM71>
The 'A' register is dead weight, but is not removed by 3.0. Then because it's accessing the unsigned char as 16-bit, it uses "tbne D," to further weigh down the function.
|