Commit 3368cdd3 by Jakub Jelinek Committed by Jakub Jelinek

re PR c++/37189 (OpenMP task construct with implicit firstprivate variables ICEs)

	PR c++/37189
	* cp-tree.h (defer_mark_used_calls, deferred_mark_used_calls): New
	extern decls.
	* decl2.c (mark_used): If defer_mark_used_calls, push decl into
	deferred_mark_used_calls vector and exit early.
	* decl.c (defer_mark_used_calls, deferred_mark_used_calls): New
	variables.
	(finish_function): Set defer_mark_used_calls for the duration of the
	function.  Call mark_used on any queued decls.

	* g++.dg/gomp/pr37189.C: New test.

From-SVN: r139955
parent 8660d962
2008-09-03 Jakub Jelinek <jakub@redhat.com>
PR c++/37189
* cp-tree.h (defer_mark_used_calls, deferred_mark_used_calls): New
extern decls.
* decl2.c (mark_used): If defer_mark_used_calls, push decl into
deferred_mark_used_calls vector and exit early.
* decl.c (defer_mark_used_calls, deferred_mark_used_calls): New
variables.
(finish_function): Set defer_mark_used_calls for the duration of the
function. Call mark_used on any queued decls.
2008-09-02 Jason Merrill <jason@redhat.com>
PR c++/37208
......
......@@ -4381,6 +4381,9 @@ extern void initialize_artificial_var (tree, tree);
extern tree check_var_type (tree, tree);
extern tree reshape_init (tree, tree);
extern bool defer_mark_used_calls;
extern GTY(()) VEC(tree, gc) *deferred_mark_used_calls;
/* in decl2.c */
extern bool check_java_method (tree);
extern tree build_memfn_type (tree, tree, cp_cv_quals);
......
......@@ -227,6 +227,11 @@ struct named_label_entry GTY(())
function, two inside the body of a function in a local class, etc.) */
int function_depth;
/* To avoid unwanted recursion, finish_function defers all mark_used calls
encountered during its execution until it finishes. */
bool defer_mark_used_calls;
VEC(tree, gc) *deferred_mark_used_calls;
/* States indicating how grokdeclarator() should handle declspecs marked
with __attribute__((deprecated)). An object declared as
__attribute__((deprecated)) suppresses warnings of uses of other
......@@ -12033,6 +12038,9 @@ finish_function (int flags)
if (fndecl == NULL_TREE)
return error_mark_node;
gcc_assert (!defer_mark_used_calls);
defer_mark_used_calls = true;
if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fndecl)
&& DECL_VIRTUAL_P (fndecl)
&& !processing_template_decl)
......@@ -12232,6 +12240,17 @@ finish_function (int flags)
cxx_pop_function_context and then reset via pop_function_context. */
current_function_decl = NULL_TREE;
defer_mark_used_calls = false;
if (deferred_mark_used_calls)
{
unsigned int i;
tree decl;
for (i = 0; VEC_iterate (tree, deferred_mark_used_calls, i, decl); i++)
mark_used (decl);
VEC_free (tree, gc, deferred_mark_used_calls);
}
return fndecl;
}
......
......@@ -3776,6 +3776,15 @@ mark_used (tree decl)
/* If we don't need a value, then we don't need to synthesize DECL. */
if (skip_evaluation)
return;
/* If within finish_function, defer the rest until that function
finishes, otherwise it might recurse. */
if (defer_mark_used_calls)
{
VEC_safe_push (tree, gc, deferred_mark_used_calls, decl);
return;
}
/* Normally, we can wait until instantiation-time to synthesize
DECL. However, if DECL is a static data member initialized with
a constant, we need the value right now because a reference to
......
2008-09-03 Jakub Jelinek <jakub@redhat.com>
PR c++/37189
* g++.dg/gomp/pr37189.C: New test.
PR debug/37322
* gfortran.dg/debug/pr35154-dwarf2.f: Fix up scan-assembler regexps.
......
// PR c++/37189
// { dg-do compile }
// { dg-options "-fopenmp" }
struct S
{
S () {}
S (S const &) {}
};
struct T
{
S s;
};
void
bar (T &)
{
}
int
foo ()
{
T t;
#pragma omp task
bar (t);
}
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