#1287 SDCC SIGSEGV's

closed-fixed
5
2013-05-25
2007-02-05
No

I'm running a locally built version of SDCC based on revision 4608 in Subversion. I only made very minor build related changes - no changes to any of the source code.

In the attached source code, the error happens because I added line 402 in src/util/circular.c

To reproduce the problem:

1. untar the attached file
2. cd into src
3. type 'make'
4. see the SIGSEGV error

Command-line that the make file uses:

sdcc --model-large --xram-size 2048 --code-size 61440 -o util/circular.rel -c util/circular.c

Output:

[schmidtw@wes src]$ make
Compiling ... board/mcu/audio.c
Compiling ... board/mcu/mmc.c
Compiling ... board/mcu/mp3.c
Compiling ... board/mcu/pll.c
Compiling ... board/mcu/spi.c
Compiling ... board/mcu/uart.c
Compiling ... board/dac.c
Compiling ... board/debug.c
Compiling ... board/serial.c
Compiling ... board/time.c
Compiling ... util/circular.c
util/circular.c:298: warning 126: unreachable code
util/circular.c:416: warning 84: 'auto' variable '(null)' may be used before initialization
Caught signal 11: SIGSEGV
make: *** [util/circular.rel] Error 1

Discussion

  • Weston T. Schmidt

    Source code used to cause SDCC to generate a SIGSEGV error

     
  • Bernhard Held

    Bernhard Held - 2007-02-05
    • labels: 101550 --> Live range problems
    • assigned_to: nobody --> bernhardheld
     
  • Bernhard Held

    Bernhard Held - 2007-02-05

    Logged In: YES
    user_id=203539
    Originator: NO

    Quick response: --noinduction keeps sdcc from segfaulting.
    Please give me short feedback, if the code behaves as expected with --noinduction.

     
  • Bernhard Held

    Bernhard Held - 2007-02-05

    Logged In: YES
    user_id=203539
    Originator: NO

    I found a bug, I'll commit the fix tomorrow.
    Does circular.c now work as expected?

    $ svn diff SDCCBBlock.c
    Index: SDCCBBlock.c
    ===================================================================
    --- SDCCBBlock.c (Revision 4617)
    +++ SDCCBBlock.c (Arbeitskopie)
    @@ -463,7 +463,10 @@
    /* if this is true then we put it before the condition else */
    /* we put it before if, this is to reduce register pressure, */
    /* we don't have to hold condition too long in a register */
    - if (ebp->ech->op == IFX)
    +
    + /* loop induction sometimes appends a GOTO instruction; */
    + /* never put it before an IFX */
    + if (ebp->ech->op == IFX && ic->op != GOTO)
    {
    iCode *ipoint;

     
  • Weston T. Schmidt

    Logged In: YES
    user_id=767003
    Originator: YES

    I tried your patch & the code behaves as expected.

    Thank you for such a quick fix,
    Wes

     
  • Bernhard Held

    Bernhard Held - 2007-02-06
    • milestone: --> fixed
    • status: open --> closed-fixed
     
  • Bernhard Held

    Bernhard Held - 2007-02-06

    Logged In: YES
    user_id=203539
    Originator: NO

    Fixed in SDCCBBlock.c (addiCodeToeBBlock) rev. 4620:
    GOTO icodes appended by loop induction must be at the very end of the eBBlock

     

Log in to post a comment.

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

Sign up for the SourceForge newsletter:





No, thanks