This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: An alias bug
- To: "David S. Miller" <davem at dm dot cobaltmicro dot com>
- Subject: Re: An alias bug
- From: Jeffrey A Law <law at cygnus dot com>
- Date: Mon, 13 Jul 1998 00:55:55 -0600
- cc: hjl at lucon dot org, egcs-bugs at cygnus dot com, mark at markmitchell dot com
- Reply-To: law at cygnus dot com
In message <199807130643.XAA09296@dm.cobaltmicro.com>you write:
> Date: Mon, 13 Jul 1998 00:08:23 -0600
> From: Jeffrey A Law <law@hurl.cygnus.com>
>
> It works by accident, not by design.
>
> The testcase is simply wrong and broken. I'm not planning any attempt
> to fix it, nor am I likely to approve a patch to fix that test.
>
> Then gcc should refuse to compile it.
That's an interesting idea, but the syntax is allowed by the C standard.
The result of running the code is either implementation dependent or
undefined (sorry I don't have the C ref here to find out exactly which)
It's just like writing code which may reference a variable which is
never set. The standard allows you to write & compile such code. But
referencing the undefined variable at runtime is going to cause problems.
> Or does GCC right now warn about such illegal things with the proper
> -W options enabled?
It would be nice to be able to catch this. I suspect it would have to
happen in the front-end since it's the only part of the compiler that
knows about casts.
jeff