#1511 --debug crashes sdcc

closed-fixed
z80 port (188)
5
2013-05-25
2009-03-01
No

Compiling the attached file with current sdcc using --mz80 --debug options results in a SIGSEGV.

Philipp

Discussion

  • Philipp Klaus Krause

     
  • Robert Larice

    Robert Larice - 2009-03-12

    it is perfectly sufficient to compile this oneliner
    int anything() { return 0; }
    with sdcc -c -mz80 --debug

    the actual crash is in z80/peep.c in function isReturned(), line 83

    do
    {
    l = l->next;
    } while(l->isComment || l->ic->op != FUNCTION);

    l is alive, but l->ic is NULL ...

    only few versions away in commit #5397
    Borut Razem seems to have modified just this line,
    perhaps he can still remember what this loop is supposed to do.
    if I read the Changelog correctly, the modification was to solve bug #2648964

    Robert Larice

     
  • Borut Ražem

    Borut Ražem - 2009-03-12

    Robert,

    I tried with the version before my change, but it also fails with the same reason: it doesn't check if l->ic is NULL.

    The the previous version l was set to the first line marked as FUNCTION, but it was not used anywhere. It was assumed that the third line after _G.head (_G.head->next->next->ic) is the function name label (first two lines are comments), which is wrong in case of --fverbose-asm --i-code-in-asm combination. My fix skips all lines which are comments or are not marked as FUNCTION. The next line is supposed to be the function name label.

    I fixed for this bug by checking also if l->ic is NULL:
    do
    {
    l = l->next;
    } while(l->isComment || l->ic == NULL || l->ic->op != FUNCTION);

    I hope this is OK.
    Robert and Philipp, can you both review my fix?

    Fixed in svn revision #5412.

    Borut

     
  • Borut Ražem

    Borut Ražem - 2009-03-12
    • labels: --> z80 port
    • milestone: --> fixed
    • assigned_to: nobody --> borutr
    • status: open --> closed-fixed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks