Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#399 Crash or bad code in Win98. Ok in WinXP.

closed
Johan Knol
4
2003-05-09
2002-09-24
No

When compiling the file 'parse.c' (sdcc -c parse.c) sdcc crashes or generates bad code on Windows
95/98 but works ok in Windows 2k/XP. Adding or removing random code in 'parse.c' will cause sdcc to
crash, generate wrong code, or even generate correct code under Windows 95/98. When line 'char j=0;'
is commented out in 'parse.c' sdcc was crashing in my Windows 98 machine, but it may just generate
bad code in Windows 95. I am using the latest CVS sources compiled with Visual C++ 6.0. I used the
same executable when testing on the four machines. It doesn't matter if I build sdcc on any of the four
machines the result is the same. When sdcc crashes it points to either sdcc\src\SDCCloop.c:214 or
sdcc\src\SDCCloop.c:216:

int
findLoopEndSeq (region * lreg)
{
eBBlock *block;
eBBlock *lblock;

for (block = lblock = setFirstItem (lreg->regBlocks); block;
block = setNextItem (lreg->regBlocks))
{
if (block != lblock && block->lSeq > lblock->lSeq) <-- CRASHES HERE
lblock = block;
}

return lblock->lSeq <-- OR CRASHES HERE
}

And the problem is that either block or lblock are invalid, for example lblock=0x00000194. I am also
including the asm listing when compiling in Windows 98 and Windows XP, in one of the many occasions
where the generated code was different. If I change the code in SDCCloop.c so that it checks for block
and lblock to be larger than (eBBlock *)0x1000 sdcc doesn't crash but it generates bad code.

Discussion

  • Zip contains parse.c, parse98.asm, and parseXP.asm

     
    Attachments
  • Johan Knol
    Johan Knol
    2003-01-27

    • assigned_to: nobody --> johanknol
     
  • Johan Knol
    Johan Knol
    2003-01-27

    Logged In: YES
    user_id=63512

    Can you confirm this still exists in latest cvs?

     
  • Logged In: YES
    user_id=603650

    Yes, it still exists. The debugger breaks at SDCCloop.c:218.

     
  • Johan Knol
    Johan Knol
    2003-02-04

    Logged In: YES
    user_id=63512

    I think my fix for bug #631653 fixed this too. If you can
    confirm, please close the bug.

    Johan

     
  • Logged In: YES
    user_id=603650

    The problem still exists.

     
  • Johan Knol
    Johan Knol
    2003-02-04

    Logged In: YES
    user_id=63512

    I can't reproduce the crash, and diffing the two asm's doesn't
    help much either. Please point me at where in the c and asm
    file it goes wrong (it's too long to reverse engineer :), there
    should be other symtoms as well in the dumpfiles.
    These are the most difficult bugs to find, really. Most likely an
    enum that starts at 0, so: uninitialized equals zero where it
    should be undefined!

    Johan
    (how about rewriting sdcc in c++ :)

     
  • Johan Knol
    Johan Knol
    2003-02-19

    • priority: 5 --> 4
     
  • Logged In: YES
    user_id=603650

    Johan fixed this bug some time ago (around March 25, 2003 I
    think). Thanks Johan!

     
    • status: open --> closed