This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] C undefined behavior fix
- From: Linus Torvalds <torvalds at transmeta dot com>
- To: <dewar at gnat dot com>
- Cc: <gcc at gcc dot gnu dot org>, <rth at redhat dot com>, <trini at kernel dot crashing dot org>
- Date: Fri, 4 Jan 2002 16:28:11 -0800 (PST)
- Subject: Re: [PATCH] C undefined behavior fix
On Fri, 4 Jan 2002 dewar@gnat.com wrote:
> <<Sure. Except is must say _something_. It must be defined behaviour. That's
> what "implementation defined" means.
> >>
>
> Defined does NOT mean it works as you want. For instance a C compiler would
> be free to say.
>
> If you cast an integer to a pointer, the system disk will be deleted. This
> is an undesirable implementation, but not a non-conforming one.
Yes. I agree. But the compiler has to say _what_ it does. It can't just
avoid the issue.
(Or rather, it obviously _can_ avoid the issue, but by golly, you
shouldn't claim that you are standards-compliant in this area if you do).
> I disagree, and I don't see that you have provided any argument to support
> this very peculiar position. Yes, a conforming compiler must document
> what it does, but it can do anything it likes.
Yes yes yes. But gcc does NOT document what it does.
Linus