4 ms·
You aren't allowed to goto a label in a different function. From the C standard: > The identifier in a goto statement shall name a label located somewhere in
by IainIreland 6y ago
You aren't allowed to goto a label in a different function.
From the C standard:
> The identifier in a goto statement shall name a label located somewhere in the enclosing function.
`Shall` is a term of art here:
> If a "shall" or "shall not" requirement that appears outside of a constraint is violated, the behavior is undefined.
(Sections 6.8.6.1.1 and 4.2, respectively: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf)
- jpcooper 6y agoAppreciated.
- jhoechtl 6y agoIt's undefined in the C standard. That doesn't mean its insecure or undefined as seen from the machine code. nothin is hilding you back to do your own code generation and clearly define this behaviour.
- MaxBarraclough 6y agoThey weren't doing their own code-generation, BEAM/C treated C as the target language, and then relied on a standard C compiler. From the article: > it is undefined behavior even in GCC. It happened to work with GCC on Sparc, but not on GCC for X86.
- deleted 6y ago[deleted]