GNU Development Chain for 68HC11/68HC12 - Bugs: bug #16626, wrong code on 68hcs12
You are not allowed to post comments on this tracker with your current authentication level.
bug #16626: wrong code on 68hcs12
Submitter: | None | ||
Submitted: | Fri 19 May 2006 08:23:01 AM UTC | ||
Category: | gcc | Severity: | 3 - Normal |
Item Group: | sw-bug | Status: | None |
Privacy: | Public | Assigned to: | None |
Open/Closed: | Open |
No files currently attached
Depends on the following items: None found
Items that depend on this one: None found
CC list is empty
There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.
No changes have been made to this item
Powered by Savane 3.13-f8d8.
Corresponding source code
I don't know if it is a bug or not.
I have problem with the following short code segment.
After the start of program the tickcount is increased every 10 ms by a timer interrupt. All seems to by ok and DoSoemthing() is called every 50 tickcounts. But if the tickcount goes from 0x7fff to 0x8000 then DoSomething() is called many times (as fast as possible). This iterate on each changing of tickcount from 0x7fff to 0x8000.
The bug occurs only on a 68hcs12 and it runs ok on a 68hc12 processor. (gcc 2.95) The assmbler output is the same for 68hc12 and 68hcs12.
extern void DoSomething();
static short tickCount = 0;
void TriggerEvent(void) {
static short nextTickTime = 0;
if (nextTickTime - tickCount <= 0) {
nextTickTime += 50;
// to do something
DoSomething();
}
}
# assembler output
TriggerEvent:
ldx nextTickTime.0
tfr x,d
subd tickCount
bgt .L1
tfr x,d
addd #50
std nextTickTime.0
bsr DoSomething
.L1:
rts