diff options
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r-- | gcc/gimplify.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c index b27776a..d8e4b13 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -1872,6 +1872,12 @@ gimplify_decl_expr (tree *stmt_p, gimple_seq *seq_p) { tree init = DECL_INITIAL (decl); bool is_vla = false; + /* Check whether a decl has FE created VALUE_EXPR here BEFORE + gimplify_vla_decl creates VALUE_EXPR for a vla decl. + If the decl has VALUE_EXPR that was created by FE (usually + C++FE), it's a proxy varaible, and FE already initialized + the VALUE_EXPR of it, we should not initialize it anymore. */ + bool decl_had_value_expr_p = DECL_HAS_VALUE_EXPR_P (decl); poly_uint64 size; if (!poly_int_tree_p (DECL_SIZE_UNIT (decl), &size) @@ -1934,7 +1940,8 @@ gimplify_decl_expr (tree *stmt_p, gimple_seq *seq_p) /* When there is no explicit initializer, if the user requested, We should insert an artifical initializer for this automatic variable. */ - else if (is_var_need_auto_init (decl)) + else if (is_var_need_auto_init (decl) + && !decl_had_value_expr_p) { gimple_add_init_for_auto_var (decl, flag_auto_var_init, |