This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] Fix miscompilation of gnat1 in LTO bootstrap
- From: Eric Botcazou <ebotcazou at adacore dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 06 Oct 2014 12:16:24 +0200
- Subject: [patch] Fix miscompilation of gnat1 in LTO bootstrap
- Authentication-results: sourceware.org; auth=none
Hi,
this is a regression from GCC 4.8.x: gnat1 (uintp.adb:UI_Lt) is miscompiled
during a LTO boostrap when Init_Operand is inlined into it. A store is
wrongly deleted by GIMPLE DSE because of a missed aliasing relationship
between 2 array types with TYPE_NONALIASED_COMPONENT set, one being a derived
of the other in Ada, hence the latter being allowed to alias the former.
Tested on x86_64-suse-linux, OK for the mainline and 4.9 branch?
2014-10-06 Eric Botcazou <ebotcazou@adacore.com>
* gimple.c (gimple_get_alias_set): Return 0 for array types with non-
aliased component and that contain PLACEHOLDER_EXPRs.
--
Eric Botcazou
Index: gimple.c
===================================================================
--- gimple.c (revision 215843)
+++ gimple.c (working copy)
@@ -2336,6 +2336,16 @@ gimple_get_alias_set (tree t)
return get_alias_set (t1);
}
+ /* For languages that distinguish array types from their component type
+ for aliasing purposes, some kind of "generic" arrays types might be
+ allowed to alias their "instantiated" derived types. The original
+ relationship between them being lost, consider that the former ones
+ can alias everything. */
+ if (TREE_CODE (t) == ARRAY_TYPE
+ && TYPE_NONALIASED_COMPONENT (t)
+ && type_contains_placeholder_p (t))
+ return 0;
+
return -1;
}