re PR middle-end/39360 (ICE in referenced_var_lookup, at tree-dfa.c:563)

PR middle-end/39360
	* tree-flow.h (add_referenced_var): Return bool instead of void.
	* tree-dfa.c (add_referenced_var): Return result of
	referenced_var_check_and_insert call.
	* tree-inline.c (expand_call_inline): Call add_referenced_var instead
	of referenced_var_check_and_insert.

	* gcc.c-torture/compile/pr39360.c: New test.

From-SVN: r144683
This commit is contained in:
Jakub Jelinek 2009-03-06 23:51:28 +01:00 committed by Jakub Jelinek
parent 9f0e7885bb
commit 65401a0ba3
6 changed files with 37 additions and 7 deletions

View File

@ -1,5 +1,12 @@
2009-03-06 Jakub Jelinek <jakub@redhat.com>
PR middle-end/39360
* tree-flow.h (add_referenced_var): Return bool instead of void.
* tree-dfa.c (add_referenced_var): Return result of
referenced_var_check_and_insert call.
* tree-inline.c (expand_call_inline): Call add_referenced_var instead
of referenced_var_check_and_insert.
PR debug/39372
* dwarf2out.c (add_abstract_origin_attribute): Return
origin_die.

View File

@ -1,5 +1,8 @@
2009-03-06 Jakub Jelinek <jakub@redhat.com>
PR middle-end/39360
* gcc.c-torture/compile/pr39360.c: New test.
PR debug/39372
* g++.dg/debug/dwarf2/static-local-var-in-ctor.C: New test.

View File

@ -0,0 +1,16 @@
/* PR middle-end/39360 */
static int a[] = { 1 };
static inline void
bar (int **x)
{
static int *c[2] = { 0, a };
*x = c[1];
}
int
foo (int **x)
{
bar (x);
}

View File

@ -1,6 +1,6 @@
/* Data flow functions for trees.
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007, 2008 Free Software
Foundation, Inc.
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009
Free Software Foundation, Inc.
Contributed by Diego Novillo <dnovillo@redhat.com>
This file is part of GCC.
@ -639,7 +639,7 @@ set_default_def (tree var, tree def)
/* Add VAR to the list of referenced variables if it isn't already there. */
void
bool
add_referenced_var (tree var)
{
var_ann_t v_ann;
@ -655,7 +655,7 @@ add_referenced_var (tree var)
/* Tag's don't have DECL_INITIAL. */
if (MTAG_P (var))
return;
return true;
/* Scan DECL_INITIAL for pointer variables as they may contain
address arithmetic referencing the address of other
@ -667,7 +667,11 @@ add_referenced_var (tree var)
optimizers. */
&& !DECL_EXTERNAL (var))
walk_tree (&DECL_INITIAL (var), find_vars_r, NULL, 0);
return true;
}
return false;
}
/* Remove VAR from the list. */

View File

@ -768,7 +768,7 @@ extern void dump_referenced_vars (FILE *);
extern void dump_variable (FILE *, tree);
extern void debug_variable (tree);
extern tree get_virtual_var (tree);
extern void add_referenced_var (tree);
extern bool add_referenced_var (tree);
extern void remove_referenced_var (tree);
extern void mark_symbols_for_renaming (gimple);
extern void find_new_referenced_vars (gimple);

View File

@ -1,5 +1,5 @@
/* Tree inlining.
Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
Free Software Foundation, Inc.
Contributed by Alexandre Oliva <aoliva@redhat.com>
@ -3383,7 +3383,7 @@ expand_call_inline (basic_block bb, gimple stmt, copy_body_data *id)
var = TREE_VALUE (t_step);
if (TREE_STATIC (var) && !TREE_ASM_WRITTEN (var))
{
if (var_ann (var) && referenced_var_check_and_insert (var))
if (var_ann (var) && add_referenced_var (var))
cfun->local_decls = tree_cons (NULL_TREE, var,
cfun->local_decls);
}