This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] C undefined behavior fix
- From: David Woodhouse <dwmw2 at infradead dot org>
- To: "Petr Vandrovec" <VANDROVE at vc dot cvut dot cz>
- Cc: Paul Koning <pkoning at equallogic dot com>, trini at kernel dot crashing dot org, velco at fadata dot bg, linux-kernel at vger dot kernel dot org, gcc at gcc dot gnu dot org, linuxppc-dev at lists dot linuxppc dot org
- Date: Wed, 02 Jan 2002 22:24:14 +0000
- Subject: Re: [PATCH] C undefined behavior fix
- References: <DC4407B5751@vcnet.vc.cvut.cz>
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