aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2010-09-19 23:49:28 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2010-09-19 21:49:28 +0000
commitd1f6261f39b061c2c65d51deb6ac12831a3b5f1e (patch)
tree75c8d4d95f109a7be0aedf92cf29859e14f9b78a /gcc
parenta963da4d4891794686c982ed3c84691dcea487fb (diff)
downloadgcc-d1f6261f39b061c2c65d51deb6ac12831a3b5f1e.zip
gcc-d1f6261f39b061c2c65d51deb6ac12831a3b5f1e.tar.gz
gcc-d1f6261f39b061c2c65d51deb6ac12831a3b5f1e.tar.bz2
re PR lto/44246 (ICE with -fwhopr/-flto when using strlen and strcat without previous declaration)
PR lto/44246 * lto-cgraph.c (input_cgraph_1, input_varpool_1): Avoid processing same node twice. * gcc.c-torture/compile/pr44246.c:New file. From-SVN: r164425
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/lto-cgraph.c23
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr44246.c5
4 files changed, 38 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 7fafcf5..00504dd 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2010-09-19 Jan Hubicka <jh@suse.cz>
+
+ PR lto/44246
+ * lto-cgraph.c (input_cgraph_1, input_varpool_1): Avoid
+ processing same node twice.
+
2010-09-19 Anatoly Sokolov <aesok@post.ru>
* config/bfin/bfin.h (CLASS_LIKELY_SPILLED_P): Remove.
diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c
index c81e3f9..22b35ee 100644
--- a/gcc/lto-cgraph.c
+++ b/gcc/lto-cgraph.c
@@ -1292,11 +1292,20 @@ input_cgraph_1 (struct lto_file_decl_data *file_data,
len = lto_input_uleb128 (ib);
}
-
+ /* AUX pointers should be all non-zero for nodes read from the stream. */
+#ifdef ENABLE_CHECKING
+ FOR_EACH_VEC_ELT (cgraph_node_ptr, nodes, i, node)
+ gcc_assert (node->aux);
+#endif
FOR_EACH_VEC_ELT (cgraph_node_ptr, nodes, i, node)
{
int ref = (int) (intptr_t) node->global.inlined_to;
+ /* We share declaration of builtins, so we may read same node twice. */
+ if (!node->aux)
+ continue;
+ node->aux = NULL;
+
/* Fixup inlined_to from reference to pointer. */
if (ref != LCC_NOT_FOUND)
node->global.inlined_to = VEC_index (cgraph_node_ptr, nodes, ref);
@@ -1311,6 +1320,8 @@ input_cgraph_1 (struct lto_file_decl_data *file_data,
else
node->same_comdat_group = NULL;
}
+ FOR_EACH_VEC_ELT (cgraph_node_ptr, nodes, i, node)
+ node->aux = (void *)1;
return nodes;
}
@@ -1332,9 +1343,17 @@ input_varpool_1 (struct lto_file_decl_data *file_data,
input_varpool_node (file_data, ib));
len--;
}
+#ifdef ENABLE_CHECKING
+ FOR_EACH_VEC_ELT (varpool_node_ptr, varpool, i, node)
+ gcc_assert (!node->aux);
+#endif
FOR_EACH_VEC_ELT (varpool_node_ptr, varpool, i, node)
{
int ref = (int) (intptr_t) node->same_comdat_group;
+ /* We share declaration of builtins, so we may read same node twice. */
+ if (node->aux)
+ continue;
+ node->aux = (void *)1;
/* Fixup same_comdat_group from reference to pointer. */
if (ref != LCC_NOT_FOUND)
@@ -1342,6 +1361,8 @@ input_varpool_1 (struct lto_file_decl_data *file_data,
else
node->same_comdat_group = NULL;
}
+ FOR_EACH_VEC_ELT (varpool_node_ptr, varpool, i, node)
+ node->aux = NULL;
return varpool;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 1ae06e4..bf28866 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2010-09-19 Jan Hubicka <jh@suse.cz>
+
+ PR lto/44246
+ * gcc.c-torture/compile/pr44246.c:New file.
+
2010-09-19 Ira Rosen <irar@il.ibm.com>
PR tree-optimization/45714
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44246.c b/gcc/testsuite/gcc.c-torture/compile/pr44246.c
new file mode 100644
index 0000000..6e47869
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr44246.c
@@ -0,0 +1,5 @@
+int main(int argc, char *argv[])
+{
+ strcat(argv[0], "X");
+ return strlen(argv[0]);
+}