This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: type based aliasing again
- To: mark@codesourcery.com (Mark Mitchell)
- Subject: Re: type based aliasing again
- From: Joe Buck <jbuck@synopsys.COM>
- Date: Wed, 8 Sep 99 21:30:43 PDT
- Cc: jbuck@synopsys.com, gcc@gcc.gnu.org, rms@gnu.org
One more thought:
[ C means that we declare an error if we detect illegal aliasing ]
Mark writes:
> I agree that C is reasonable. But, it is not technically viable at
> compile-time; the violation of the rule is a dynamic property. For
> example, consider:
>
> if (0) {
> /* Do illegal aliasing stuff. */
> }
>
> If we do dead-code elimination late, we might ask questions about the
> aliasing in the conditional code. Since that code never executes,
> ANSI says there's no violation.
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.