re PR tree-optimization/45083 (strange warning text from gcc)

PR tree-optimization/45083
	* tree-inline.c (add_local_variables): Also remap DECL_DEBUG_EXPR.

	* gcc.dg/pr45083.c: New test.

From-SVN: r162559
This commit is contained in:
Jakub Jelinek 2010-07-27 11:43:59 +02:00 committed by Jakub Jelinek
parent 2b0cb007fa
commit 42694189bd
4 changed files with 53 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2010-07-27 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/45083
* tree-inline.c (add_local_variables): Also remap DECL_DEBUG_EXPR.
2010-07-27 Bernd Schmidt <bernds@codesourcery.com>
* postreload.c (reload_combine_recognize_const_pattern): Move test

View File

@ -1,3 +1,8 @@
2010-07-27 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/45083
* gcc.dg/pr45083.c: New test.
2010-07-26 Tobias Burnus <burnus@net-b.de>
PR fortran/40873

View File

@ -0,0 +1,25 @@
/* PR tree-optimization/45083 */
/* { dg-do compile } */
/* { dg-options "-O2 -Wuninitialized" } */
struct S { char *a; unsigned b; unsigned c; };
extern int foo (const char *);
extern void bar (int, int);
static void
baz (void)
{
struct S cs[1]; /* { dg-message "was declared here" } */
switch (cs->b) /* { dg-warning "cs\[^\n\r\]*\\.b\[^\n\r\]*is used uninitialized" } */
{
case 101:
if (foo (cs->a)) /* { dg-warning "cs\[^\n\r\]*\\.a\[^\n\r\]*may be used uninitialized" } */
bar (cs->c, cs->b); /* { dg-warning "cs\[^\n\r\]*\\.c\[^\n\r\]*may be used uninitialized" } */
}
}
void
test (void)
{
baz ();
}

View File

@ -3687,7 +3687,24 @@ add_local_variables (struct function *callee, struct function *caller,
add_local_decl (caller, var);
}
else if (!can_be_nonlocal (var, id))
add_local_decl (caller, remap_decl (var, id));
{
tree new_var = remap_decl (var, id);
/* Remap debug-expressions. */
if (TREE_CODE (new_var) == VAR_DECL
&& DECL_DEBUG_EXPR_IS_FROM (new_var)
&& new_var != var)
{
tree tem = DECL_DEBUG_EXPR (var);
bool old_regimplify = id->regimplify;
id->remapping_type_depth++;
walk_tree (&tem, copy_tree_body_r, id, NULL);
id->remapping_type_depth--;
id->regimplify = old_regimplify;
SET_DECL_DEBUG_EXPR (new_var, tem);
}
add_local_decl (caller, new_var);
}
}
/* Fetch callee declaration from the call graph edge going from NODE and