Commit d1f6261f by Jan Hubicka Committed by Jan Hubicka

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
parent a963da4d
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> 2010-09-19 Anatoly Sokolov <aesok@post.ru>
* config/bfin/bfin.h (CLASS_LIKELY_SPILLED_P): Remove. * config/bfin/bfin.h (CLASS_LIKELY_SPILLED_P): Remove.
......
...@@ -1292,11 +1292,20 @@ input_cgraph_1 (struct lto_file_decl_data *file_data, ...@@ -1292,11 +1292,20 @@ input_cgraph_1 (struct lto_file_decl_data *file_data,
len = lto_input_uleb128 (ib); 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) FOR_EACH_VEC_ELT (cgraph_node_ptr, nodes, i, node)
{ {
int ref = (int) (intptr_t) node->global.inlined_to; 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. */ /* Fixup inlined_to from reference to pointer. */
if (ref != LCC_NOT_FOUND) if (ref != LCC_NOT_FOUND)
node->global.inlined_to = VEC_index (cgraph_node_ptr, nodes, ref); 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, ...@@ -1311,6 +1320,8 @@ input_cgraph_1 (struct lto_file_decl_data *file_data,
else else
node->same_comdat_group = NULL; node->same_comdat_group = NULL;
} }
FOR_EACH_VEC_ELT (cgraph_node_ptr, nodes, i, node)
node->aux = (void *)1;
return nodes; return nodes;
} }
...@@ -1332,9 +1343,17 @@ input_varpool_1 (struct lto_file_decl_data *file_data, ...@@ -1332,9 +1343,17 @@ input_varpool_1 (struct lto_file_decl_data *file_data,
input_varpool_node (file_data, ib)); input_varpool_node (file_data, ib));
len--; 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) FOR_EACH_VEC_ELT (varpool_node_ptr, varpool, i, node)
{ {
int ref = (int) (intptr_t) node->same_comdat_group; 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. */ /* Fixup same_comdat_group from reference to pointer. */
if (ref != LCC_NOT_FOUND) if (ref != LCC_NOT_FOUND)
...@@ -1342,6 +1361,8 @@ input_varpool_1 (struct lto_file_decl_data *file_data, ...@@ -1342,6 +1361,8 @@ input_varpool_1 (struct lto_file_decl_data *file_data,
else else
node->same_comdat_group = NULL; node->same_comdat_group = NULL;
} }
FOR_EACH_VEC_ELT (varpool_node_ptr, varpool, i, node)
node->aux = NULL;
return varpool; return varpool;
} }
......
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> 2010-09-19 Ira Rosen <irar@il.ibm.com>
PR tree-optimization/45714 PR tree-optimization/45714
......
int main(int argc, char *argv[])
{
strcat(argv[0], "X");
return strlen(argv[0]);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment