#289 SDCC generate wrong assembly code

closed-rejected
Johan Knol
None
1
2013-05-25
2002-02-06
Anonymous
No

Attached are the 'C' source file, compile options used
(cl.bat) and the generated assembly file that zipped.
I'm using the sdcc on windows platform.

I found that in the function 'Running', the program
enters endless loop in the assembly file - bug.asm
(line 293 - 296).

If one dummy variable is define and make it equal to
the timerCount variable as illustrated below, the
program can run normally.
.
.
.
while (step) {
if (timerCount == 0) {
step-- ;
tCount = 0 ;
}
while (tCount == 0)
tCount = timerCount ;
}
.
.

Discussion

  • Bernhard Held
    Bernhard Held
    2002-02-06

    Logged In: YES
    user_id=203539

    Please attach the files. Without the source the bug is not
    reproducable.

     
  • Johan Knol
    Johan Knol
    2002-02-08

    Logged In: YES
    user_id=63512

    Most likely the compiler knows that timerCount!=0, so the
    if body will be skipped and step will never be incremented
    and the loop goes on forever.
    Maybe timerCount should be volatile?

    No source, no solutions.

     
  • Johan Knol
    Johan Knol
    2002-02-08

    • priority: 5 --> 1
    • milestone: --> 100456
     
  • Johan Knol
    Johan Knol
    2002-02-08

    • assigned_to: nobody --> johanknol
     
  • Ho Wai Fung
    Ho Wai Fung
    2002-02-11

    Logged In: YES
    user_id=450496

    I uploaded the source file when this report was submitted.
    Anyway, how to attach the source files now?

     
  • Johan Knol
    Johan Knol
    2002-02-18

    • labels: 355283 -->
    • milestone: 100456 --> non_bugs
    • status: open --> closed-rejected
     
  • Johan Knol
    Johan Knol
    2002-02-18

    Logged In: YES
    user_id=63512

    timerCount needs to be volatile