#1999 SIGSEGV - function pointer in struct

open
nobody
5
2012-04-02
2012-03-31
mz-fuzzy
No

Caught signal 11: SIGSEGV for code:

typedef struct {
int (*func)(void);
} struct_t;

int f(void);

struct_t inst = { f };

int f(void)
{
return (-1);
}
==========================

SDCC : mcs51/gbz80/z80/z180/r2k/ds390/pic16/pic14/TININative/ds400/hc08 3.1.4 #7508 (Mar 30 2012) (Linux)

Discussion

  • mz-fuzzy
    mz-fuzzy
    2012-03-31

     
    Attachments
  • mz-fuzzy
    mz-fuzzy
    2012-03-31

    • priority: 5 --> 6
     
  • This is not a silent failure: It is cleary visible to the user. Furthermore, a workaround exists (assigning memeber in main function). Thus using priority 5.

    Philipp

     
    • priority: 6 --> 5