diff options
author | Jason Merrill <jason@redhat.com> | 2020-06-06 00:07:21 -0400 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2020-06-09 12:05:50 -0400 |
commit | ef41587df9839d1dfc77dbc48a0830e42b36626e (patch) | |
tree | 71f9a40bd19f2e7a614caff1b7a634b6a75cc2dc /gcc | |
parent | bf4ab2689bb586971d5b2ab6b13d078cd7ac45af (diff) | |
download | gcc-ef41587df9839d1dfc77dbc48a0830e42b36626e.zip gcc-ef41587df9839d1dfc77dbc48a0830e42b36626e.tar.gz gcc-ef41587df9839d1dfc77dbc48a0830e42b36626e.tar.bz2 |
c++: Tweak predeclare_vla.
We only need to predeclare a VLA type if it's wrapped in a pointer type;
otherwise gimplify_type_sizes will handle it.
gcc/cp/ChangeLog:
PR c++/95552
* cp-gimplify.c (predeclare_vla): Only predeclare a VLA if it's
wrapped in a pointer type.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/cp-gimplify.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c index e8fbc30..0e949e2 100644 --- a/gcc/cp/cp-gimplify.c +++ b/gcc/cp/cp-gimplify.c @@ -1205,7 +1205,8 @@ predeclare_vla (tree expr) return expr; vla = TREE_TYPE (vla); } - if (TYPE_NAME (vla) || !variably_modified_type_p (vla, NULL_TREE)) + if (vla == type || TYPE_NAME (vla) + || !variably_modified_type_p (vla, NULL_TREE)) return expr; tree decl = build_decl (input_location, TYPE_DECL, NULL_TREE, vla); |