This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: An alias bug



  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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]