#1060 SIGSEGV on static array of function pointers

closed-fixed
nobody
5
2013-05-25
2006-02-08
No

1 - sample code:
<pre>
-------------------------------------
void f(void)
{
}

static void (*a[])(void) = {
f,
0,
};

void
main(void)
{
void (**p)(void) = a;

while (0 != *p) {
(*p)();
++p;
}
}
-------------------------------------
</pre>

2 - SDCC command:
$ sdcc -mpic14 -pp16f877 -c t.c

3 - sdcc version:
$ sdcc -v
SDCC :
mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/hc08
2.5.4 #1199 (Feb 7 2006) (MINGW32)

4 - error message:
Caught signal 11: SIGSEGV

If the keyword "static" is ommited in "static void
(*a[])(void) = {", then the code compiles without
errors, but the a array of function pointers is not
initialized!

Borut

Discussion

  • Nobody/Anonymous

    Logged In: NO

    I think this is a special case of the bug I've been
    experiencing - #1433337.
    - Zik Saleeba

     
  • Raphael Neider

    Raphael Neider - 2006-06-19

    Logged In: YES
    user_id=1115835

    SIGSEGV is unreproducable in SDCC r4242.
    Data remains uninitialized...

     
  • Raphael Neider

    Raphael Neider - 2008-03-07
    • milestone: --> fixed
    • status: open --> closed-fixed
     
  • Raphael Neider

    Raphael Neider - 2008-03-07

    Logged In: YES
    user_id=1115835
    Originator: NO

    Segmentation fault does not occur and the array is now properly initialized.

    Fix added in SDCC 2.7.5, r5074.

    Regards,
    Raphael

     

Log in to post a comment.

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

Sign up for the SourceForge newsletter:





No, thanks