Menu ▾ ▴

#294 segmentation fault

closed-fixed
5
12 hours ago
2002-02-12
Anonymous
No

main() { ((void (code *) (void)) 0) (); }

results in a segmentation fault.
SDCC :
mcs51/gbz80/z80/avr/ds390/pic14/i186/tlcs900h/TININative/xa51
2.3.1 (Feb 11 2002) (UNIX)

In a library for the Keil compiler this piece of code
is used for restarting the program:
#define abort() (((void (code *) (void)) 0) ())

Corvin

Related

Bugs: #3916

Discussion

  • Johan Knol

    Johan Knol - 2002-02-22

    Logged In: YES
    user_id=63512

    fixed in SDCC.y:1.55

     
  • Johan Knol

    Johan Knol - 2002-02-22
    • milestone: --> fixed
    • assigned_to: nobody --> johanknol
    • status: open --> closed-fixed
     
  • Christopher Bazley

    Christopher Bazley - 16 hours ago

    Section 5.3 of the ISO Technical Report 'Extensions to support embedded processors' (https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1275.pdf ) explicitly prohibits the grammar used by the Keil header:

    "Clause 6.7.3 - Type qualifiers, add three new constraint paragraphs:
    ...
    A function type shall not be qualified by an address-space qualifier"

     
  • Christopher Bazley

    Christopher Bazley - 16 hours ago

    This grammar also introduces ambiguity with function type names, because it is unclear whether a type name such as void (code *) (void) is meant to be an abstract declaration of a function with a single parameter of type code *, or a pointer to some type derived from void that is qualified by code.

     
  • Maarten Brock

    Maarten Brock - 12 hours ago

    For reference: this was applied in [r1947] by Johan.

    [bugs:#496] might be related.

     

    Related

    Bugs: #496


    Last edit: Maarten Brock 12 hours ago

Log in to post a comment.