[PATCH] C undefined behavior fix
David Woodhouse
dwmw2@infradead.org
Wed Jan 2 14:25:00 GMT 2002
VANDROVE@vc.cvut.cz said:
> (and for CONSTANT < 5 it of course generated correct code to fill dst
> with string contents; and yes, I know that code will sigsegv on run
> because of dst is not initialized - but it should die at runtime, not
> at compile time).
An ICE, while it's not quite what was expected and it'll probably get fixed,
is nonetheless a perfectly valid implementation of 'undefined behaviour'.
You should count yourself lucky that the compiler didn't beat you up, sleep
with your mother, and/or start WW III.
Contributors to this thread who want to write a kernel in some C-like
language other than C probably ought to start by writing their own compiler,
rather than complaining about gcc. (I won't suggest starting with a language
spec, as the people in question don't really seem to be interested in
those.)
That or implement DWIM for gcc, I suppose...
Can we fix the broken code and stop being silly now, please?
--
dwmw2
More information about the Gcc
mailing list