[PATCH] C undefined behavior fix

Richard Henderson rth@redhat.com
Sat Jan 5 19:25:00 GMT 2002


On Sat, Jan 05, 2002 at 12:21:15PM -0800, Linus Torvalds wrote:
> Now, that information is gone at the RTL level, but just adding some kind
> of "alias barrier" whenever the compiler sees a integer/pointer cast would
> certainly fix it. (Might be as simple as just a flag on the expression
> that tells the alias logic to not follow the RTL further or something).

Perhaps.  The only thing I can think that would be guaranteed
to work would be something like a

	(set (reg) (dont-look-here (reg)))

rtx.  If we did a Meaningful Bit on a reg thing, we'd have to
be extremely careful during cse.  Probably not worth the effort.

Something to think about for gcc 3.2.

> (I thought gcc people didn't like statement expressions, but that
> would definitely be forced upon people if that's the only "out").

I don't like the implementation, and there are a number of aspects
that aren't nearly well enough defined.  Most of those issues are
control flow related (either by goto, return, or throw), but there
are other bits of nastiness that affect c++ wrt lifetime of temporaries.

Other than that I think they're cool.  ;-)


r~



More information about the Gcc mailing list