* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@94317
138bc75d-0d04-0410-961f-
82ee72b054a4
+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,
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);
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);
}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options -O2 -Wuninitialized } */
+
+int sys_msgctl (void)
+{
+ struct { int mode; } setbuf; /* { dg-warning "'setbuf[.]mode' is used" } */
+ return setbuf.mode;
+}
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
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);
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 *);
\f
/* Return true if DECL is an SRA candidate. */
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)
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)
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
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. */