This is the mail archive of the
mailing list for the GCC project.
[lto][patch] Fix internal compiler error in stabilize_va_list
- From: "Cary Coutant" <ccoutant at google dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 23 Oct 2008 15:58:18 -0700
- Subject: [lto][patch] Fix internal compiler error in stabilize_va_list
The following patch fixes an ICE in stabilize_va_list, when the type
of the va_list parameter does not match the builtin va_list_type_node.
The problem occurs only on x86_64, where the builtin va_list type is
an array type instead of a simple type, and where the parameter has a
pointer type to the underlying type. When building the list of
preloaded common nodes in lto_get_common_nodes, we were recording only
the top-level type nodes, so the underlying type was not recognized as
a common type, and was streamed out and reconstructed by the reader.
As a result, the type was not recognized as the builtin type in
stabilize_va_list. This patch fixes the problem by checking
specifically for an array type in lto_record_common_node, and records
the underlying type node as well.
There's an existing FIXME in lto_record_common_node:
/* FIXME lto: In principle, we should perform a walk over all nodes reachable
from each preloaded node. This is going to be a lot of work. At present,
we catch the case that was causing test failures. A small step. */
It may be about time to take a longer look at this, but this patch
takes just one more small step.
I've boiled this down to the simple test case included below, but I'm
not sure yet where to put LTO tests.
------- valist.c -------
myprintf(const char *fmt, ...)
n = vprintf(fmt, args);
n = myprintf("%s: %d\n", "foo", 1);
2008-10-23 Cary Coutant <firstname.lastname@example.org>
* lto-section-out.c (lto_record_common_node): For array types,
record the underlying type.
--- lto-section-out.c (revision 141329)
+++ lto-section-out.c (working copy)
@@ -877,6 +877,10 @@ lto_record_common_node (tree node, VEC(t
lto_record_common_node (TYPE_MAIN_VARIANT (node), common_nodes,
+ if (TREE_CODE (node) == ARRAY_TYPE)
+ lto_record_common_node (TREE_TYPE (node), common_nodes, seen_nodes);