omp-low.c (create_omp_child_function): Set DECL_CONTEXT for DECL.

* omp-low.c (create_omp_child_function): Set DECL_CONTEXT
	for DECL.
	* cgraphunit.c (cgraph_build_static_cdtor): Likewise.
	* tree-dfa.c (find_referenced_vars_in): Factor out of ...
	(find_vars_r): ... here.
	* tree-flow.h (find_referenced_vars_in): Declare.
	* tree-ssa-pre.c (create_expression_by_pieces): Assert
	that AVAIL_OUT exists for BLOCK.
	* Makefile.in (CGRAPH_H): Add dependency on cif-code.def
	(tree-loop-distribution.o): Fix dependency on TREE_VECTORIZER_H.
	(tree-parloops.o): Likewise.

testsuite/ChangeLog

	* gcc.c-torture/execute/builtins/strlen-3.c: Fix ODR
	violation for variable 'inside_main'.

From-SVN: r146295
This commit is contained in:
Diego Novillo 2009-04-17 17:45:56 -04:00 committed by Diego Novillo
parent 4e53d196cc
commit 07485407e1
9 changed files with 56 additions and 22 deletions

View File

@ -1,3 +1,17 @@
2009-04-17 Diego Novillo <dnovillo@google.com>
* omp-low.c (create_omp_child_function): Set DECL_CONTEXT
for DECL.
* cgraphunit.c (cgraph_build_static_cdtor): Likewise.
* tree-dfa.c (find_referenced_vars_in): Factor out of ...
(find_vars_r): ... here.
* tree-flow.h (find_referenced_vars_in): Declare.
* tree-ssa-pre.c (create_expression_by_pieces): Assert
that AVAIL_OUT exists for BLOCK.
* Makefile.in (CGRAPH_H): Add dependency on cif-code.def
(tree-loop-distribution.o): Fix dependency on TREE_VECTORIZER_H.
(tree-parloops.o): Likewise.
2009-04-17 Simon Baldwin <simonb@google.com>
* toplev.c (default_tree_printer): Add handling for %E format.

View File

@ -832,7 +832,7 @@ CFGLOOP_H = cfgloop.h $(BASIC_BLOCK_H) $(RTL_H) vecprim.h double-int.h
IPA_UTILS_H = ipa-utils.h $(TREE_H) $(CGRAPH_H)
IPA_REFERENCE_H = ipa-reference.h $(BITMAP_H) $(TREE_H)
IPA_TYPE_ESCAPE_H = ipa-type-escape.h $(TREE_H)
CGRAPH_H = cgraph.h $(TREE_H) $(BASIC_BLOCK_H)
CGRAPH_H = cgraph.h $(TREE_H) $(BASIC_BLOCK_H) cif-code.def
DF_H = df.h $(BITMAP_H) $(BASIC_BLOCK_H) alloc-pool.h $(TIMEVAR_H)
RESOURCE_H = resource.h hard-reg-set.h $(DF_H)
DDG_H = ddg.h sbitmap.h $(DF_H)
@ -2399,11 +2399,11 @@ tree-loop-distribution.o: tree-loop-distribution.c $(CONFIG_H) $(SYSTEM_H) coret
$(TM_H) $(GGC_H) $(OPTABS_H) $(TREE_H) $(RTL_H) $(BASIC_BLOCK_H) \
$(DIAGNOSTIC_H) $(TREE_FLOW_H) $(TREE_DUMP_H) $(TIMEVAR_H) $(CFGLOOP_H) \
$(TREE_PASS_H) $(TREE_DATA_REF_H) $(SCEV_H) $(EXPR_H) \
$(TARGET_H) tree-chrec.h langhooks.h tree-vectorizer.h
$(TARGET_H) tree-chrec.h langhooks.h $(TREE_VECTORIZER_H)
tree-parloops.o: tree-parloops.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(TREE_FLOW_H) $(TREE_H) $(RTL_H) $(CFGLOOP_H) $(TREE_DATA_REF_H) $(GGC_H) \
$(DIAGNOSTIC_H) $(TREE_PASS_H) $(SCEV_H) langhooks.h gt-tree-parloops.h \
tree-vectorizer.h
$(TREE_VECTORIZER_H)
tree-stdarg.o: tree-stdarg.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(TREE_H) $(FUNCTION_H) $(DIAGNOSTIC_H) $(TREE_FLOW_H) $(TREE_PASS_H) \
tree-stdarg.h $(TARGET_H) langhooks.h

View File

@ -1369,6 +1369,7 @@ cgraph_build_static_cdtor (char which, tree body, int priority)
resdecl = build_decl (RESULT_DECL, NULL_TREE, void_type_node);
DECL_ARTIFICIAL (resdecl) = 1;
DECL_RESULT (decl) = resdecl;
DECL_CONTEXT (resdecl) = decl;
allocate_struct_function (decl, false);

View File

@ -1577,6 +1577,7 @@ create_omp_child_function (omp_context *ctx, bool task_copy)
t = build_decl (RESULT_DECL, NULL_TREE, void_type_node);
DECL_ARTIFICIAL (t) = 1;
DECL_IGNORED_P (t) = 1;
DECL_CONTEXT (t) = decl;
DECL_RESULT (decl) = t;
t = build_decl (PARM_DECL, get_identifier (".omp_data_i"), ptr_type_node);

View File

@ -1,3 +1,8 @@
2009-04-17 Diego Novillo <dnovillo@google.com>
* gcc.c-torture/execute/builtins/strlen-3.c: Fix ODR
violation for variable 'inside_main'.
2009-04-17 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
* gfortran.fortran-torture/execute/getarg_1.x: New file.

View File

@ -10,7 +10,7 @@ extern char *strcpy (char *, const char *);
static const char bar[] = "Hello, World!";
static const char baz[] = "hello, world?";
static const char larger[20] = "short string";
extern volatile int inside_main;
extern int inside_main;
int l1 = 1;
int x = 6;

View File

@ -88,26 +88,10 @@ find_referenced_vars (void)
FOR_EACH_BB (bb)
{
for (si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si))
{
size_t i;
gimple stmt = gsi_stmt (si);
for (i = 0; i < gimple_num_ops (stmt); i++)
walk_tree (gimple_op_ptr (stmt, i), find_vars_r, NULL, NULL);
}
find_referenced_vars_in (gsi_stmt (si));
for (si = gsi_start_phis (bb); !gsi_end_p (si); gsi_next (&si))
{
gimple phi = gsi_stmt (si);
size_t i, len = gimple_phi_num_args (phi);
walk_tree (gimple_phi_result_ptr (phi), find_vars_r, NULL, NULL);
for (i = 0; i < len; i++)
{
tree arg = gimple_phi_arg_def (phi, i);
walk_tree (&arg, find_vars_r, NULL, NULL);
}
}
find_referenced_vars_in (gsi_stmt (si));
}
return 0;
@ -498,6 +482,33 @@ find_vars_r (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED)
return NULL_TREE;
}
/* Find referenced variables in STMT. In contrast with
find_new_referenced_vars, this function will not mark newly found
variables for renaming. */
void
find_referenced_vars_in (gimple stmt)
{
size_t i;
if (gimple_code (stmt) != GIMPLE_PHI)
{
for (i = 0; i < gimple_num_ops (stmt); i++)
walk_tree (gimple_op_ptr (stmt, i), find_vars_r, NULL, NULL);
}
else
{
walk_tree (gimple_phi_result_ptr (stmt), find_vars_r, NULL, NULL);
for (i = 0; i < gimple_phi_num_args (stmt); i++)
{
tree arg = gimple_phi_arg_def (stmt, i);
walk_tree (&arg, find_vars_r, NULL, NULL);
}
}
}
/* Lookup UID in the referenced_vars hashtable and return the associated
variable. */

View File

@ -616,6 +616,7 @@ extern tree gimple_default_def (struct function *, tree);
extern bool stmt_references_abnormal_ssa_name (gimple);
extern tree get_ref_base_and_extent (tree, HOST_WIDE_INT *,
HOST_WIDE_INT *, HOST_WIDE_INT *);
extern void find_referenced_vars_in (gimple);
/* In tree-phinodes.c */
extern void reserve_phi_args_for_new_edge (basic_block);

View File

@ -3003,6 +3003,7 @@ create_expression_by_pieces (basic_block block, pre_expr expr,
add_to_value (VN_INFO (forcedname)->value_id, nameexpr);
if (!in_fre)
bitmap_value_replace_in_set (NEW_SETS (block), nameexpr);
gcc_assert (AVAIL_OUT (block));
bitmap_value_replace_in_set (AVAIL_OUT (block), nameexpr);
}
mark_symbols_for_renaming (stmt);