This is the mail archive of the gcc@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]
Other format: [Raw text]

Re: [PATCH] C undefined behavior fix



On Sat, 5 Jan 2002, Richard Henderson wrote:
>
> 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.

I thought about the CSE issues, and couldn't come up with a good reason to
propagate the bit over a combine. If we have mathematically the same
pointer dereference done some other way, I don't see why the compiler
couldn't pick up the information from there (ie we are obviously doing the
same "undefined" dereference with other pieces, and dropping the magic bit
isn't dropping any information at that point).

However, the extra "dont-look-here" RTL step would certainly guarantee
that the thing is not ever dropped, and that could be useful for _another_
case, namely potentially being the explicit out for type-based aliasing
issue (*).

			Linus

(*) Maybe you remember that unrelated discussion from long ago - with the
kernel not being able to use strict type-based alias rules because there
was no clean way to get "out" of that particular box either?


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