From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mark Mitchell To: jbuck@synopsys.com Cc: craig@jcb-sc.com, law@cygnus.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: <19990909105948H.mitchell@codesourcery.com> References: <19990909145321.4127.qmail@deer> <199909091733.KAA13478@atrus.synopsys.com> X-SW-Source: 1999-09n/msg00365.html Message-ID: <19990930180200.dOwFIsHzUz4fbqVE-dEwsdc8lCrWOAm6xGmBGXlyYVo@z> >>>>> "Joe" == Joe Buck writes: Joe> Let's get out of the mode of treating the user like an Joe> opponent. We need to make clear that the fact that we issue Joe> warnings for some type violations is not a guarantee that Joe> code not warned about is safe. I do think that the warning, if we can figure out how to make it useful, is a good thing. (As we've discussed, doing that is non-trivial technically, even though it is certainly theoretically possible.) (It's easy to say "something in this function might be bogus"; harder to give a more intelligent message complete with types, line numbers, etc.) But, while the user is not an opponent, and while I'm not sure people would really make the kinds of scripts Craig mentioned, I do think Craig and I agree on the fact that a poorly-specified extension will frustruate users in two respects: o Why doesn't the compiler know that these two things, which "obviously" refer to the same location, alias? Why don't I get the warning (and hence safe code) in that case? Why, when I make the following "insignificant" change, does the compiler figure out then? People will complain about this. And people will submit patches to help the compiler "know" these things. (If these patches consist of genuinely improved alias analysis, that will be good; if they are just hacks to get old broken code to work, that will be bad.) o Why, when six months ago my code worked fine, and now I upgraded GCC, did it break? People are unlikely to notice that some warning *went away*, and that therefore their code is *more* likely to break. (They don't even tend to notice *new* warnings, but I, for one, can't imagine myself noticing that my favorite software package compiled with fewer warnings. And if I did, I can't imagine being *worried*.) I do think the warning could be valuable, especially if it could say: `x' and `y' have different types, but seem to refer to the same memory location Right now the only easy thing to print for `x' and `y' is going to be a pile of RTL; not useful to the average person. We could save the types used to create the alias sets (especially now that we have GC, and therefore it's easy to keep them around); then it would be simple to say `double' and `int' have different types, but you seem to have memory that has both of these types at once But, that's about as good as we could without some kind of major infrastructure overhaul. -- Mark Mitchell mark@codesourcery.com CodeSourcery, LLC http://www.codesourcery.com