This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH][alias-improvements] Throttle down TBAA for Fortran
- From: Richard Guenther <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 19 Jan 2009 17:10:00 +0100 (CET)
- Subject: [PATCH][alias-improvements] Throttle down TBAA for Fortran
Fortran has a type merging problem (like it has a function decl merging
problem). This causes us to miscompile protein on the alias-improvements
branch.
Fixed with the following ugl^Wnice hack.
Richard.
2009-01-19 Richard Guenther <rguenther@suse.de>
* tree-ssa-alias.c (same_type_for_tbaa): Fortran cannot reliably
say that two types are not equal, so say don't know for it.
* gcc.dg/tree-ssa/pr38895.c: Adjust testcase to test what it
was supposed to test.
Index: gcc/tree-ssa-alias.c
===================================================================
*** gcc/tree-ssa-alias.c (revision 143496)
--- gcc/tree-ssa-alias.c (working copy)
*************** same_type_for_tbaa (tree type1, tree typ
*** 373,379 ****
return -1;
/* Compare the canonical types. */
! return (TYPE_CANONICAL (type1) == TYPE_CANONICAL (type2)) ? 1 : 0;
}
/* Return true, if the two memory references REF1 and REF2 may alias. */
--- 373,388 ----
return -1;
/* Compare the canonical types. */
! if (TYPE_CANONICAL (type1) == TYPE_CANONICAL (type2))
! return 1;
!
! /* ??? The Fortran frontend does not properly merge equivalent types,
! so we cannot say 0 for it. */
! if (strcmp (lang_hooks.name, "GNU Fortran") == 0)
! return -1;
!
! /* The types are known to be not equal. */
! return 0;
}
/* Return true, if the two memory references REF1 and REF2 may alias. */
Index: gcc/testsuite/gcc.dg/tree-ssa/pr38895.c
===================================================================
*** gcc/testsuite/gcc.dg/tree-ssa/pr38895.c (revision 143496)
--- gcc/testsuite/gcc.dg/tree-ssa/pr38895.c (working copy)
*************** struct C {
*** 16,22 ****
int foo(struct C *c, struct B *b)
{
c->a1.i = 1;
! b->a1.j = 0;
return c->a1.i;
}
--- 16,22 ----
int foo(struct C *c, struct B *b)
{
c->a1.i = 1;
! b->a1.i = 0;
return c->a1.i;
}