Commit e2df2328 by Jakub Jelinek Committed by Jakub Jelinek

re PR c++/77739 (internal compiler error: in create_tmp_var, at gimple-expr.c:524)

	PR c++/77739
	* cp-gimplify.c (cp_gimplify_tree) <case VEC_INIT_EXPR>: Pass
	false as handle_invisiref_parm_p to cp_genericize_tree.
	(struct cp_genericize_data): Add handle_invisiref_parm_p field.
	(cp_genericize_r): Don't wrap is_invisiref_parm into references
	if !wtd->handle_invisiref_parm_p.
	(cp_genericize_tree): Add handle_invisiref_parm_p argument,
	set wtd.handle_invisiref_parm_p to it.
	(cp_genericize): Pass true as handle_invisiref_parm_p to
	cp_genericize_tree.  Formatting fix.

	* g++.dg/cpp1y/pr77739.C: New test.

From-SVN: r242766
parent 75631692
2016-11-23 Jakub Jelinek <jakub@redhat.com>
PR c++/77739
* cp-gimplify.c (cp_gimplify_tree) <case VEC_INIT_EXPR>: Pass
false as handle_invisiref_parm_p to cp_genericize_tree.
(struct cp_genericize_data): Add handle_invisiref_parm_p field.
(cp_genericize_r): Don't wrap is_invisiref_parm into references
if !wtd->handle_invisiref_parm_p.
(cp_genericize_tree): Add handle_invisiref_parm_p argument,
set wtd.handle_invisiref_parm_p to it.
(cp_genericize): Pass true as handle_invisiref_parm_p to
cp_genericize_tree. Formatting fix.
2016-11-21 Bernd Edlinger <bernd.edlinger@hotmail.de> 2016-11-21 Bernd Edlinger <bernd.edlinger@hotmail.de>
PR c++/71973 PR c++/71973
......
...@@ -38,7 +38,7 @@ along with GCC; see the file COPYING3. If not see ...@@ -38,7 +38,7 @@ along with GCC; see the file COPYING3. If not see
static tree cp_genericize_r (tree *, int *, void *); static tree cp_genericize_r (tree *, int *, void *);
static tree cp_fold_r (tree *, int *, void *); static tree cp_fold_r (tree *, int *, void *);
static void cp_genericize_tree (tree*); static void cp_genericize_tree (tree*, bool);
static tree cp_fold (tree); static tree cp_fold (tree);
/* Local declarations. */ /* Local declarations. */
...@@ -623,7 +623,7 @@ cp_gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p) ...@@ -623,7 +623,7 @@ cp_gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
tf_warning_or_error); tf_warning_or_error);
hash_set<tree> pset; hash_set<tree> pset;
cp_walk_tree (expr_p, cp_fold_r, &pset, NULL); cp_walk_tree (expr_p, cp_fold_r, &pset, NULL);
cp_genericize_tree (expr_p); cp_genericize_tree (expr_p, false);
ret = GS_OK; ret = GS_OK;
input_location = loc; input_location = loc;
} }
...@@ -995,6 +995,7 @@ struct cp_genericize_data ...@@ -995,6 +995,7 @@ struct cp_genericize_data
struct cp_genericize_omp_taskreg *omp_ctx; struct cp_genericize_omp_taskreg *omp_ctx;
tree try_block; tree try_block;
bool no_sanitize_p; bool no_sanitize_p;
bool handle_invisiref_parm_p;
}; };
/* Perform any pre-gimplification folding of C++ front end trees to /* Perform any pre-gimplification folding of C++ front end trees to
...@@ -1111,7 +1112,7 @@ cp_genericize_r (tree *stmt_p, int *walk_subtrees, void *data) ...@@ -1111,7 +1112,7 @@ cp_genericize_r (tree *stmt_p, int *walk_subtrees, void *data)
} }
/* Otherwise, do dereference invisible reference parms. */ /* Otherwise, do dereference invisible reference parms. */
if (is_invisiref_parm (stmt)) if (wtd->handle_invisiref_parm_p && is_invisiref_parm (stmt))
{ {
*stmt_p = convert_from_reference (stmt); *stmt_p = convert_from_reference (stmt);
*walk_subtrees = 0; *walk_subtrees = 0;
...@@ -1511,7 +1512,7 @@ cp_genericize_r (tree *stmt_p, int *walk_subtrees, void *data) ...@@ -1511,7 +1512,7 @@ cp_genericize_r (tree *stmt_p, int *walk_subtrees, void *data)
/* Lower C++ front end trees to GENERIC in T_P. */ /* Lower C++ front end trees to GENERIC in T_P. */
static void static void
cp_genericize_tree (tree* t_p) cp_genericize_tree (tree* t_p, bool handle_invisiref_parm_p)
{ {
struct cp_genericize_data wtd; struct cp_genericize_data wtd;
...@@ -1520,6 +1521,7 @@ cp_genericize_tree (tree* t_p) ...@@ -1520,6 +1521,7 @@ cp_genericize_tree (tree* t_p)
wtd.omp_ctx = NULL; wtd.omp_ctx = NULL;
wtd.try_block = NULL_TREE; wtd.try_block = NULL_TREE;
wtd.no_sanitize_p = false; wtd.no_sanitize_p = false;
wtd.handle_invisiref_parm_p = handle_invisiref_parm_p;
cp_walk_tree (t_p, cp_genericize_r, &wtd, NULL); cp_walk_tree (t_p, cp_genericize_r, &wtd, NULL);
delete wtd.p_set; delete wtd.p_set;
wtd.bind_expr_stack.release (); wtd.bind_expr_stack.release ();
...@@ -1639,12 +1641,12 @@ cp_genericize (tree fndecl) ...@@ -1639,12 +1641,12 @@ cp_genericize (tree fndecl)
/* Expand all the array notations here. */ /* Expand all the array notations here. */
if (flag_cilkplus if (flag_cilkplus
&& contains_array_notation_expr (DECL_SAVED_TREE (fndecl))) && contains_array_notation_expr (DECL_SAVED_TREE (fndecl)))
DECL_SAVED_TREE (fndecl) = DECL_SAVED_TREE (fndecl)
expand_array_notation_exprs (DECL_SAVED_TREE (fndecl)); = expand_array_notation_exprs (DECL_SAVED_TREE (fndecl));
/* We do want to see every occurrence of the parms, so we can't just use /* We do want to see every occurrence of the parms, so we can't just use
walk_tree's hash functionality. */ walk_tree's hash functionality. */
cp_genericize_tree (&DECL_SAVED_TREE (fndecl)); cp_genericize_tree (&DECL_SAVED_TREE (fndecl), true);
if (flag_sanitize & SANITIZE_RETURN if (flag_sanitize & SANITIZE_RETURN
&& do_ubsan_in_current_function ()) && do_ubsan_in_current_function ())
......
2016-11-23 Jakub Jelinek <jakub@redhat.com>
PR c++/77739
* g++.dg/cpp1y/pr77739.C: New test.
2016-11-23 Martin Jambor <mjambor@suse.cz> 2016-11-23 Martin Jambor <mjambor@suse.cz>
* c-c++-common/gomp/gridify-1.c: Update scan string. * c-c++-common/gomp/gridify-1.c: Update scan string.
......
// PR c++/77739
// { dg-do compile { target c++14 } }
struct A {
A();
A(const A &);
};
struct B {
B();
template <typename... Args> auto g(Args &&... p1) {
return [=] { f(p1...); };
}
void f(A, const char *);
};
B::B() { g(A(), ""); }
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