From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joe Buck To: mark@codesourcery.com (Mark Mitchell) Cc: jbuck@synopsys.com, gcc@gcc.gnu.org, rms@gnu.org Subject: Re: type based aliasing again Date: Wed, 08 Sep 1999 21:33:00 -0000 Message-id: <199909090430.VAA24607@atrus.synopsys.com> References: <19990908202957F.mitchell@codesourcery.com> X-SW-Source: 1999-09/msg00330.html 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. From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joe Buck To: mark@codesourcery.com (Mark Mitchell) Cc: jbuck@synopsys.com, gcc@gcc.gnu.org, rms@gnu.org Subject: Re: type based aliasing again Date: Thu, 30 Sep 1999 18:02:00 -0000 Message-ID: <199909090430.VAA24607@atrus.synopsys.com> References: <19990908202957F.mitchell@codesourcery.com> X-SW-Source: 1999-09n/msg00330.html Message-ID: <19990930180200.AaU7WcsYFlxzxsEL1ZWk3j7Zk8I3yhAo_Y9uCB3V8bM@z> 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.