Thu 09 Dec 2004 08:07:58 AM UTC, original submission:
Hi
During the compilaton of µC/CosII, I found a bug in the compiler or the optimizer.
I put below the 2 lignes C sources and two version of the assembler generate with or without Frame-pointer.
//=========================================================================
C source
if (OSTCBPrioTbl[prio] == (OS_TCB *)0) {
OSTCBPrioTbl[prio] = (OS_TCB *)1;
//=========================================================================
Compile with \usr\bin\m6811-elf-gcc -S -Os -mshort -o tst.s kernel\os_task.c
Assembler generate with a big bug
ldx *_.frame
clra
ldab 15,x
asld
addd #OSTCBPrioTbl
std 2,x
xgdx
ldd 0,x ; Value of OSTCBPrioTbl[prio] and flags update
ldx *_.frame ; flags lost thats a bugs
std 4,x ; why
bne .L19 ;
ldd #1
ldx 2,x
std 0,x
//=========================================================================
Compile with \usr\bin\m6811-elf-gcc -S -Os -mshort -fomit-frame-pointer -o tst.s kernel\os_task.c
Assembler generate without bug
tsx
clra
ldab 12,x
asld
addd #OSTCBPrioTbl
std 1,x
xgdx
ldd 0,x ; Value of OSTCBPrioTbl[prio] and flags update
tsx ; flags not affected
std 3,x
bne .L19
ldd #1
ldx 1,x
std 0,x
Kind regards
Michel Clerbois
-unavailable-
|