diff options
author | Cesar Philippidis <cesar@codesourcery.com> | 2015-07-24 07:38:43 -0700 |
---|---|---|
committer | Cesar Philippidis <cesar@gcc.gnu.org> | 2015-07-24 07:38:43 -0700 |
commit | 710ee218547fc4ecbcba7a0f1dff73ce51fffb7b (patch) | |
tree | 4caf60c4272974485ca33f106b3ebe2e407dc7d9 /gcc | |
parent | 009cea8635f5266381322e0450dfa72758a89c4c (diff) | |
download | gcc-710ee218547fc4ecbcba7a0f1dff73ce51fffb7b.zip gcc-710ee218547fc4ecbcba7a0f1dff73ce51fffb7b.tar.gz gcc-710ee218547fc4ecbcba7a0f1dff73ce51fffb7b.tar.bz2 |
re PR libgomp/66714 (ICE in loc_list_from_tree with -g)
PR 66714
gcc/
* tree-cfg.c (struct replace_decls_d): New struct.
(replace_block_vars_by_duplicates_1): New function.
(replace_block_vars_by_duplicates): Use it to replace the decls
in the value exprs by duplicates.
libgomp/
* testsuite/libgomp.c/pr66714.c: New test.
From-SVN: r226160
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/tree-cfg.c | 39 |
2 files changed, 46 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index dac9e4a3..8737508 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2015-07-24 Cesar Philippidis <cesar@codesourcery.com> + + PR 66714 + * tree-cfg.c (struct replace_decls_d): New struct. + (replace_block_vars_by_duplicates_1): New function. + (replace_block_vars_by_duplicates): Use it to replace the decls + in the value exprs by duplicates. + 2015-07-24 Szabolcs Nagy <szabolcs.nagy@arm.com> * config/aarch64/aarch64-elf-raw.h (LINK_SPEC): Handle -h, -static, diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 66f999e..e26454a 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -71,6 +71,7 @@ along with GCC; see the file COPYING3. If not see #include "omp-low.h" #include "tree-cfgcleanup.h" #include "wide-int-print.h" +#include "gimplify.h" /* This file contains functions for building the Control Flow Graph (CFG) for a function tree. */ @@ -109,6 +110,13 @@ struct cfg_stats_d static struct cfg_stats_d cfg_stats; +/* Data to pass to replace_block_vars_by_duplicates_1. */ +struct replace_decls_d +{ + hash_map<tree, tree> *vars_map; + tree to_context; +}; + /* Hash table to store last discriminator assigned for each locus. */ struct locus_discrim_map { @@ -6853,6 +6861,31 @@ new_label_mapper (tree decl, void *data) return m->to; } +/* Tree walker to replace the decls used inside value expressions by + duplicates. */ + +static tree +replace_block_vars_by_duplicates_1 (tree *tp, int *walk_subtrees, void *data) +{ + struct replace_decls_d *rd = (struct replace_decls_d *)data; + + switch (TREE_CODE (*tp)) + { + case VAR_DECL: + case PARM_DECL: + case RESULT_DECL: + replace_by_duplicate_decl (tp, rd->vars_map, rd->to_context); + break; + default: + break; + } + + if (IS_TYPE_OR_DECL_P (*tp)) + *walk_subtrees = false; + + return NULL; +} + /* Change DECL_CONTEXT of all BLOCK_VARS in block, including subblocks. */ @@ -6872,7 +6905,11 @@ replace_block_vars_by_duplicates (tree block, hash_map<tree, tree> *vars_map, { if (TREE_CODE (*tp) == VAR_DECL && DECL_HAS_VALUE_EXPR_P (*tp)) { - SET_DECL_VALUE_EXPR (t, DECL_VALUE_EXPR (*tp)); + tree x = DECL_VALUE_EXPR (*tp); + struct replace_decls_d rd = { vars_map, to_context }; + unshare_expr (x); + walk_tree (&x, replace_block_vars_by_duplicates_1, &rd, NULL); + SET_DECL_VALUE_EXPR (t, x); DECL_HAS_VALUE_EXPR_P (t) = 1; } DECL_CHAIN (t) = DECL_CHAIN (*tp); |