re PR c++/14329 ([4.1 only] badly formatted warnings for SRA replacements used uninitialized)
PR tree-opt/14329 * tree.h (struct tree_decl): Add debug_expr_is_from. (DECL_DEBUG_EXPR_IS_FROM): New. (DECL_DEBUG_EXPR): Rename from DECL_DEBUG_ALIAS_OF. * dwarf2out.c (dwarf2out_var_location): Update to match. * tree-outof-ssa.c (create_temp): Likewise. * var-tracking.c (track_expr_p): Likewise. * tree-sra.c (instantiate_element): Set DECL_DEBUG_EXPR. * c-objc-common.c (c_tree_printer) <'D'>: Handle DECL_DEBUG_EXPR. * toplev.c (default_tree_printer): Likewise. From-SVN: r94317
This commit is contained in:
parent
17c2195719
commit
dad2a933ba
|
@ -1,3 +1,16 @@
|
|||
2005-01-27 Richard Henderson <rth@redhat.com>
|
||||
|
||||
PR tree-opt/14329
|
||||
* tree.h (struct tree_decl): Add debug_expr_is_from.
|
||||
(DECL_DEBUG_EXPR_IS_FROM): New.
|
||||
(DECL_DEBUG_EXPR): Rename from DECL_DEBUG_ALIAS_OF.
|
||||
* dwarf2out.c (dwarf2out_var_location): Update to match.
|
||||
* tree-outof-ssa.c (create_temp): Likewise.
|
||||
* var-tracking.c (track_expr_p): Likewise.
|
||||
* tree-sra.c (instantiate_element): Set DECL_DEBUG_EXPR.
|
||||
* c-objc-common.c (c_tree_printer) <'D'>: Handle DECL_DEBUG_EXPR.
|
||||
* toplev.c (default_tree_printer): Likewise.
|
||||
|
||||
2005-01-27 Alexandre Oliva <aoliva@redhat.com>
|
||||
|
||||
* config/frv/frv.c (frv_class_likely_spilled_p): Add GR8_REGS,
|
||||
|
|
|
@ -177,6 +177,17 @@ c_tree_printer (pretty_printer *pp, text_info *text)
|
|||
switch (*text->format_spec)
|
||||
{
|
||||
case 'D':
|
||||
if (DECL_DEBUG_EXPR (t) && DECL_DEBUG_EXPR_IS_FROM (t))
|
||||
{
|
||||
t = DECL_DEBUG_EXPR (t);
|
||||
if (!DECL_P (t))
|
||||
{
|
||||
pp_c_expression (cpp, t);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
/* FALLTHRU */
|
||||
|
||||
case 'F':
|
||||
if (DECL_NAME (t))
|
||||
n = lang_hooks.decl_printable_name (t, 2);
|
||||
|
|
|
@ -13131,8 +13131,9 @@ dwarf2out_var_location (rtx loc_note)
|
|||
last_insn = loc_note;
|
||||
last_label = newloc->label;
|
||||
decl = NOTE_VAR_LOCATION_DECL (loc_note);
|
||||
if (DECL_DEBUG_ALIAS_OF (decl))
|
||||
decl = DECL_DEBUG_ALIAS_OF (decl);
|
||||
if (DECL_DEBUG_EXPR (decl) && DECL_DEBUG_EXPR_IS_FROM (decl)
|
||||
&& DECL_P (DECL_DEBUG_EXPR (decl)))
|
||||
decl = DECL_DEBUG_EXPR (decl);
|
||||
add_var_loc_to_decl (decl, newloc);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-options -O2 -Wuninitialized } */
|
||||
|
||||
int sys_msgctl (void)
|
||||
{
|
||||
struct { int mode; } setbuf; /* { dg-warning "'setbuf[.]mode' is used" } */
|
||||
return setbuf.mode;
|
||||
}
|
29
gcc/toplev.c
29
gcc/toplev.c
|
@ -1554,23 +1554,36 @@ default_pch_valid_p (const void *data_p, size_t len)
|
|||
static bool
|
||||
default_tree_printer (pretty_printer * pp, text_info *text)
|
||||
{
|
||||
tree t;
|
||||
|
||||
switch (*text->format_spec)
|
||||
{
|
||||
case 'D':
|
||||
t = va_arg (*text->args_ptr, tree);
|
||||
if (DECL_DEBUG_EXPR (t) && DECL_DEBUG_EXPR_IS_FROM (t))
|
||||
t = DECL_DEBUG_EXPR (t);
|
||||
break;
|
||||
|
||||
case 'F':
|
||||
case 'T':
|
||||
{
|
||||
tree t = va_arg (*text->args_ptr, tree);
|
||||
const char *n = DECL_NAME (t)
|
||||
? lang_hooks.decl_printable_name (t, 2)
|
||||
: "<anonymous>";
|
||||
pp_string (pp, n);
|
||||
}
|
||||
return true;
|
||||
t = va_arg (*text->args_ptr, tree);
|
||||
break;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
if (DECL_P (t))
|
||||
{
|
||||
const char *n = DECL_NAME (t)
|
||||
? lang_hooks.decl_printable_name (t, 2)
|
||||
: "<anonymous>";
|
||||
pp_string (pp, n);
|
||||
}
|
||||
else
|
||||
dump_generic_node (pp, t, 0, 0, 0);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Initialization of the front end environment, before command line
|
||||
|
|
|
@ -157,10 +157,16 @@ create_temp (tree t)
|
|||
name = "temp";
|
||||
tmp = create_tmp_var (type, name);
|
||||
|
||||
if (DECL_DEBUG_ALIAS_OF (t))
|
||||
DECL_DEBUG_ALIAS_OF (tmp) = DECL_DEBUG_ALIAS_OF (t);
|
||||
if (DECL_DEBUG_EXPR (t) && DECL_DEBUG_EXPR_IS_FROM (t))
|
||||
{
|
||||
DECL_DEBUG_EXPR (tmp) = DECL_DEBUG_EXPR (t);
|
||||
DECL_DEBUG_EXPR_IS_FROM (tmp) = 1;
|
||||
}
|
||||
else if (!DECL_IGNORED_P (t))
|
||||
DECL_DEBUG_ALIAS_OF (tmp) = t;
|
||||
{
|
||||
DECL_DEBUG_EXPR (tmp) = t;
|
||||
DECL_DEBUG_EXPR_IS_FROM (tmp) = 1;
|
||||
}
|
||||
DECL_ARTIFICIAL (tmp) = DECL_ARTIFICIAL (t);
|
||||
DECL_IGNORED_P (tmp) = DECL_IGNORED_P (t);
|
||||
add_referenced_tmp_var (tmp);
|
||||
|
|
|
@ -144,6 +144,8 @@ static struct obstack sra_obstack;
|
|||
static void dump_sra_elt_name (FILE *, struct sra_elt *);
|
||||
extern void debug_sra_elt_name (struct sra_elt *);
|
||||
|
||||
/* Forward declarations. */
|
||||
static tree generate_element_ref (struct sra_elt *);
|
||||
|
||||
/* Return true if DECL is an SRA candidate. */
|
||||
|
||||
|
@ -1112,15 +1114,25 @@ instantiate_element (struct sra_elt *elt)
|
|||
|
||||
elt->replacement = var = make_rename_temp (elt->type, "SR");
|
||||
DECL_SOURCE_LOCATION (var) = DECL_SOURCE_LOCATION (base);
|
||||
TREE_NO_WARNING (var) = TREE_NO_WARNING (base);
|
||||
DECL_ARTIFICIAL (var) = DECL_ARTIFICIAL (base);
|
||||
DECL_IGNORED_P (var) = DECL_IGNORED_P (base);
|
||||
DECL_ARTIFICIAL (var) = 1;
|
||||
|
||||
if (DECL_NAME (base) && !DECL_IGNORED_P (base))
|
||||
{
|
||||
char *pretty_name = build_element_name (elt);
|
||||
DECL_NAME (var) = get_identifier (pretty_name);
|
||||
obstack_free (&sra_obstack, pretty_name);
|
||||
|
||||
DECL_DEBUG_EXPR (var) = generate_element_ref (elt);
|
||||
DECL_DEBUG_EXPR_IS_FROM (var) = 1;
|
||||
|
||||
DECL_IGNORED_P (var) = 0;
|
||||
TREE_NO_WARNING (var) = TREE_NO_WARNING (base);
|
||||
}
|
||||
else
|
||||
{
|
||||
DECL_IGNORED_P (var) = 1;
|
||||
/* ??? We can't generate any warning that would be meaningful. */
|
||||
TREE_NO_WARNING (var) = 1;
|
||||
}
|
||||
|
||||
if (dump_file)
|
||||
|
|
13
gcc/tree.h
13
gcc/tree.h
|
@ -2018,9 +2018,13 @@ struct tree_binfo GTY (())
|
|||
writing debugging information about vfield and vbase decls for C++. */
|
||||
#define DECL_FCONTEXT(NODE) (FIELD_DECL_CHECK (NODE)->decl.vindex)
|
||||
|
||||
/* For VAR_DECL, this is set to the variable we were split from, due to
|
||||
optimization. */
|
||||
#define DECL_DEBUG_ALIAS_OF(NODE) (DECL_CHECK (NODE)->decl.vindex)
|
||||
/* For VAR_DECL, this is set to either an expression that it was split
|
||||
from (if DECL_DEBUG_EXPR_IS_FROM is true), otherwise a tree_list of
|
||||
subexpressions that it was split into. */
|
||||
#define DECL_DEBUG_EXPR(NODE) (DECL_CHECK (NODE)->decl.vindex)
|
||||
|
||||
#define DECL_DEBUG_EXPR_IS_FROM(NODE) \
|
||||
(DECL_CHECK (NODE)->decl.debug_expr_is_from)
|
||||
|
||||
/* Every ..._DECL node gets a unique number. */
|
||||
#define DECL_UID(NODE) (DECL_CHECK (NODE)->decl.uid)
|
||||
|
@ -2361,7 +2365,8 @@ struct tree_decl GTY(())
|
|||
unsigned possibly_inlined : 1;
|
||||
unsigned preserve_flag: 1;
|
||||
unsigned gimple_formal_temp : 1;
|
||||
/* 13 unused bits. */
|
||||
unsigned debug_expr_is_from : 1;
|
||||
/* 12 unused bits. */
|
||||
|
||||
union tree_decl_u1 {
|
||||
/* In a FUNCTION_DECL for which DECL_BUILT_IN holds, this is
|
||||
|
|
|
@ -1460,8 +1460,15 @@ track_expr_p (tree expr)
|
|||
don't need to track this expression if the ultimate declaration is
|
||||
ignored. */
|
||||
realdecl = expr;
|
||||
if (DECL_DEBUG_ALIAS_OF (realdecl))
|
||||
realdecl = DECL_DEBUG_ALIAS_OF (realdecl);
|
||||
if (DECL_DEBUG_EXPR (realdecl)
|
||||
&& DECL_DEBUG_EXPR_IS_FROM (realdecl))
|
||||
{
|
||||
realdecl = DECL_DEBUG_EXPR (realdecl);
|
||||
/* ??? We don't yet know how to emit DW_OP_piece for variable
|
||||
that has been SRA'ed. */
|
||||
if (!DECL_P (realdecl))
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Do not track EXPR if REALDECL it should be ignored for debugging
|
||||
purposes. */
|
||||
|
|
Loading…
Reference in New Issue