This is the mail archive of the gcc-patches@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: dce3 botch with c41203a ACATS test


[ Moved from gcc@ ]

On Sat, 2004-07-24 at 22:29, Richard Kenner wrote:

> The deletions of SR.* are fine, but not those of T.7.  The next non-deleted
> statement references it.
>
> *** c41203a.adb.t34.redphi2	2004-07-24 22:12:28.000000000 -0400
> --- c41203a.adb.t35.dce3	2004-07-24 22:12:28.000000000 -0400
> ***************
> *** 64,85 ****
>     T.6[-2147483648]{lb: -2147483648 sz: 1} = 0;
>     T.6[-2147483647]{lb: -2147483648 sz: 1} = 0;
> -   SR.20_39 = 0;
> -   SR.21_40 = 0;
> -   SR.22_41 = 1;
> -   SR.23_42 = 0;
> -   SR.24_43 = 1;
> -   SR.25_44 = 1;
> -   SR.25_45 = 1;
> -   SR.24_46 = 1;
> -   SR.23_47 = 0;
> -   SR.22_48 = 1;
> -   SR.21_49 = 0;
> -   SR.20_50 = 0;
> -   T.7[6]{lb: 1 sz: 1} = 1;
> -   T.7[5]{lb: 1 sz: 1} = 1;
> -   T.7[4]{lb: 1 sz: 1} = 0;
> -   T.7[3]{lb: 1 sz: 1} = 1;
> -   T.7[2]{lb: 1 sz: 1} = 0;
> -   T.7[1]{lb: 1 sz: 1} = 0;
>     T.9_28 = &T.7[1 ...]{lb: 1 sz: 1};
>     T.10_29 = (boolean[-2147483648 .. -2147483647] *)T.9_28;
> --- 64,67 ----
> 
Indeed.  This was a bug in the type based alias analyzer.  The test case
is taking the address of an array, so we create a type tag that has an
array type, but then we go on to compute the alias set of the elements
of the array.  So, we fail to match that type tag with T.7.

There's another problem in the points-to analyzer, in that it does not
realize that T.9_28 points to T.7, but that is not a correctness
problem.  The type-based analysis ought to have triggered in this case.

Now, I do not remember why we were taking the alias set of the elements
of an array, and I cannot find either a comment or a ChangeLog.  This
has been there for a *long* time, I probably added it when I first
implemented the alias pass.  It obviously doesn't trigger for any other
language, because taking it out had zero effect.

Kenner, was this program part of the Ada test suite?  I can't seem to
trigger this in other languages.  The cut down test case you sent me
separately also has the same problem.  If it's not in the test suite,
would you mind adding it?

Bootstrapped on x86, x86-64, ia64, alpha and ppc.


Diego.


	* tree-ssa-alias.c (create_alias_map_for): Do not get the
	alias set of the inner type of ARRAY_TYPEs.

Index: tree-ssa-alias.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-alias.c,v
retrieving revision 2.20
diff -d -c -p -r2.20 tree-ssa-alias.c
*** tree-ssa-alias.c	28 Jul 2004 17:57:27 -0000	2.20
--- tree-ssa-alias.c	30 Jul 2004 06:15:01 -0000
*************** create_alias_map_for (tree var, struct a
*** 1253,1263 ****
    struct alias_map_d *alias_map;
    alias_map = xcalloc (1, sizeof (*alias_map));
    alias_map->var = var;
! 
!   if (TREE_CODE (TREE_TYPE (var)) == ARRAY_TYPE)
!     alias_map->set = get_alias_set (TREE_TYPE (TREE_TYPE (var)));
!   else
!     alias_map->set = get_alias_set (var);
    ai->addressable_vars[ai->num_addressable_vars++] = alias_map;
  }
  
--- 1253,1259 ----
    struct alias_map_d *alias_map;
    alias_map = xcalloc (1, sizeof (*alias_map));
    alias_map->var = var;
!   alias_map->set = get_alias_set (var);
    ai->addressable_vars[ai->num_addressable_vars++] = alias_map;
  }



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