An alias bug
Jeffrey A Law
law@cygnus.com
Mon Jul 13 00:16:00 GMT 1998
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
More information about the Gcc-bugs
mailing list