This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: TREE_ADDRESSABLE problem
- From: Richard Henderson <rth at redhat dot com>
- To: Jan Hubicka <jh at suse dot cz>
- Cc: gcc at gcc dot gnu dot org, law at redhat dot com
- Date: Wed, 19 Nov 2003 15:20:09 -0800
- Subject: Re: TREE_ADDRESSABLE problem
- References: <20031119230256.GS11681@kam.mff.cuni.cz>
On Thu, Nov 20, 2003 at 12:02:56AM +0100, Jan Hubicka wrote:
> Hi,
> the following testcase taken from testustie:
>
> typedef struct {
> int a, b, c, d, e, f;
> } A;
>
> void foo (A *v, int w1, int x, int *y, int *z)
> {
> }
>
> void
> bar (A *v, int x, int y, int w2, int h)
> {
> if (v->a != x || v->b != y) {
> int oldw = w2;
> int oldh = h;
> int e = v->e;
> int f = v->f;
> int dx, dy;
> foo(v, 0, 0, &w2, &h);
> dx = (oldw - w2) * (double) e/2.0;
> dy = (oldh - h) * (double) f/2.0;
> x += dx;
> y += dy;
> v->a = x;
> v->b = y;
> v->c = w2;
> v->d = h;
> }
> }
>
> int main ()
> {
> A w = { 100, 110, 20, 30, -1, -1 };
> bar (&w,400,420,50,70);
> if (w.d != 70)
> abort();
> exit(0);
> }
>
> Does not pass TREE_ADDRESSABLE check with my checking code with -O3.
> The problem is that we first compile function bar, inline foo and
> elliminate reference to w2, clear TREE_ADDRESSABLE in must_alias pass.
> Then we inline bar body into main but TREE_ADDRESSABLE is not set even
> though it is used.
Huh? (1) w2 in bar and w2 in bar-inlined-in-main are two different
decls. (2) w2 isn't used after optimization, ever, not even in main.
r~