This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: type based aliasing again
- To: jbuck at synopsys dot COM
- Subject: Re: type based aliasing again
- From: "Martin v. Loewis" <martin at mira dot isdn dot cs dot tu-berlin dot de>
- Date: Thu, 9 Sep 1999 10:14:55 +0200
- CC: gcc at gcc dot gnu dot org
- References: <199909090430.VAA24607@atrus.synopsys.com>
> Careful. Are you sure that ANSI says that we can't call this an error?
> Is the language describing the type rules for accesses distinct from
> other language like
>
> const int foo = 3;
> if (0) {
> foo = 4;
> }
>
> ? It's illegal to assign to a const, but here we are not assigning to
> a const, because the code is unreachable.
There's a difference between ill-formed code (which typically must be
diagnosed), and code exhibiting undefined behaviour. Your example is
of the former category; the aliasing stuff is of the latter.
Of course, the compiler may produce warnings which are not
diagnostics; it must still accept a well-formed program afterwards.
Regards,
Martin