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
This commit is contained in:
Cesar Philippidis 2015-07-24 07:38:43 -07:00 committed by Cesar Philippidis
parent 009cea8635
commit 710ee21854
4 changed files with 67 additions and 1 deletions

View File

@ -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,

View File

@ -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);

View File

@ -1,3 +1,7 @@
2015-07-24 Cesar Philippidis <cesar@codesourcery.com>
* testsuite/libgomp.c/pr66714.c: New test.
2015-07-22 Maxim Blumenthal <maxim.blumenthal@intel.com>
PR libgomp/66950

View File

@ -0,0 +1,17 @@
/* { dg-do "compile" } */
/* { dg-additional-options "--param ggc-min-expand=0" } */
/* { dg-additional-options "--param ggc-min-heapsize=0" } */
/* { dg-additional-options "-g" } */
/* Minimized from on target-2.c. */
void
fn3 (int x)
{
double b[3 * x];
int i;
#pragma omp target
#pragma omp parallel for
for (i = 0; i < x; i++)
b[i] += 1;
}