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
Logged In: YES
user_id=63512
fixed in SDCC.y:1.55
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"
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 typecode *, or a pointer to some type derived fromvoidthat is qualified bycode.For reference: this was applied in [r1947] by Johan.
[bugs:#496] might be related.
Related
Bugs:
#496Last edit: Maarten Brock 12 hours ago