sdcc.exe -mz80 --nostdlib --nostdinc --fverbose-asm -I../include -c buggy_dequeue.c
SDCC : z80/r2k/r4k/pic16/pic14/hc08 3.0.4 #6784 (Aug 30 2011) (CYGWIN)
see ASSERTS in the source code
I suspect it is a bug in an optimization pass. A wrong value gets store in a file scope variable, and
the array update is lost.
The bug occours in line 39/40:
next_head = delay_next[delaying_task_head];
delay_next[delaying_task_head] = NULL_IDX;
iy is overwritten with &delaying_task_head, at the end of the code for line 39, but line 40 assumes that it still holds delay_next + delaying_task_head
I have added the attachment to sdcc in revision #6803 as regression test bug3401973.c. It is disabled for the z80 until the bug is fixed.
Philipp
Philipp
Fixed in revision #6851.
Philipp