From mboxrd@z Thu Jan 1 00:00:00 1970 From: Richard Henderson To: Linus Torvalds Cc: craig@jcb-sc.com, davem@redhat.com, mark@codesourcery.com, chip@perlsupport.com, egcs@egcs.cygnus.com Subject: Re: Linux and aliasing? Date: Fri, 04 Jun 1999 15:02:00 -0000 Message-id: <19990604150152.A18469@cygnus.com> References: <19990604015713.18068.qmail@deer> X-SW-Source: 1999-06/msg00183.html This thread is huge, and there is obviously a bit of bile swilling about, so I probably won't read it all. However, I will point out one thing -- On Thu, Jun 03, 1999 at 11:02:35PM -0700, Linus Torvalds wrote: > The extremely straightforward rule that at least I would advocate is _so_ > straightforward as to be almost scary: > - if there is a pointer cast, that pointer cast invalidates all > type-based alias information. Doing what you want is actually very hard for GCC right now. Consider int i; short s, *ps = (short *)&i; i = 0; s = *ps; Due to a long-ago quirk of history, GCC processes the abstract syntax tree one statement at a time, so the fact of the cast is long gone by the time we do the dereference. Mark got around this problem by annotating the memories as we create them, which is good enough to pass legal muster, but not good enough for what you want. To do what you want, we'd have to annotate pointers instead of memories and then do global data flow analysis to find out what addresses have been "infected" by the cast. Doing anything on a local scale wouldn't be good enough, I don't think, to handle code coming in from inlines. Now, we do want to do some of this, since if you can do global data flow analysis, you can propogate points-to data that gets you even better alias info than what we have now. We'd just fall back on type information for lack of interprocedural alias info. But something like that is a long way off. r~ From mboxrd@z Thu Jan 1 00:00:00 1970 From: Richard Henderson To: Linus Torvalds Cc: craig@jcb-sc.com, davem@redhat.com, mark@codesourcery.com, chip@perlsupport.com, egcs@egcs.cygnus.com Subject: Re: Linux and aliasing? Date: Wed, 30 Jun 1999 15:43:00 -0000 Message-ID: <19990604150152.A18469@cygnus.com> References: <19990604015713.18068.qmail@deer> X-SW-Source: 1999-06n/msg00183.html Message-ID: <19990630154300.41RT0djTUMkYJ6CNZ2l5PuUlx8-JdPJJqKq1X6n4-zQ@z> This thread is huge, and there is obviously a bit of bile swilling about, so I probably won't read it all. However, I will point out one thing -- On Thu, Jun 03, 1999 at 11:02:35PM -0700, Linus Torvalds wrote: > The extremely straightforward rule that at least I would advocate is _so_ > straightforward as to be almost scary: > - if there is a pointer cast, that pointer cast invalidates all > type-based alias information. Doing what you want is actually very hard for GCC right now. Consider int i; short s, *ps = (short *)&i; i = 0; s = *ps; Due to a long-ago quirk of history, GCC processes the abstract syntax tree one statement at a time, so the fact of the cast is long gone by the time we do the dereference. Mark got around this problem by annotating the memories as we create them, which is good enough to pass legal muster, but not good enough for what you want. To do what you want, we'd have to annotate pointers instead of memories and then do global data flow analysis to find out what addresses have been "infected" by the cast. Doing anything on a local scale wouldn't be good enough, I don't think, to handle code coming in from inlines. Now, we do want to do some of this, since if you can do global data flow analysis, you can propogate points-to data that gets you even better alias info than what we have now. We'd just fall back on type information for lack of interprocedural alias info. But something like that is a long way off. r~