Commit 466446b0 by Jason Merrill

x

From-SVN: r13934
parent ce717ce4
...@@ -838,7 +838,7 @@ char text_end_label[MAX_ARTIFICIAL_LABEL_BYTES]; ...@@ -838,7 +838,7 @@ char text_end_label[MAX_ARTIFICIAL_LABEL_BYTES];
#ifdef PC_REGNUM #ifdef PC_REGNUM
#define DWARF_FRAME_RETURN_COLUMN DWARF_FRAME_REGNUM (PC_REGNUM) #define DWARF_FRAME_RETURN_COLUMN DWARF_FRAME_REGNUM (PC_REGNUM)
#else #else
#define DWARF_FRAME_RETURN_COLUMN FIRST_PSEUDO_REGISTER + 1 #define DWARF_FRAME_RETURN_COLUMN FIRST_PSEUDO_REGISTER
#endif #endif
#endif #endif
...@@ -6042,17 +6042,13 @@ add_name_attribute (die, name_string) ...@@ -6042,17 +6042,13 @@ add_name_attribute (die, name_string)
} }
/* Given a tree node describing an array bound (either lower or upper) output /* Given a tree node describing an array bound (either lower or upper) output
a representation for that bound. a representation for that bound. */
FIXME: This uses location descriptions for variable bounds, whereas the
DWARF-2 spec only allowes for constants or DIE references. */
static void static void
add_bound_info (subrange_die, bound_attr, bound) add_bound_info (subrange_die, bound_attr, bound)
register dw_die_ref subrange_die; register dw_die_ref subrange_die;
register enum dwarf_attribute bound_attr; register enum dwarf_attribute bound_attr;
register tree bound; register tree bound;
{ {
register dw_loc_descr_ref bound_loc = NULL;
register unsigned bound_value = 0; register unsigned bound_value = 0;
switch (TREE_CODE (bound)) switch (TREE_CODE (bound))
{ {
...@@ -6077,43 +6073,36 @@ add_bound_info (subrange_die, bound_attr, bound) ...@@ -6077,43 +6073,36 @@ add_bound_info (subrange_die, bound_attr, bound)
/* ... fall thru... */ /* ... fall thru... */
case SAVE_EXPR: case SAVE_EXPR:
/* Handle the simple case of `int ar[i];'. */
if (bound_attr == DW_AT_upper_bound && is_c_family ()
&& TREE_CODE (TREE_OPERAND (bound, 0)) == MINUS_EXPR)
{
tree t = TREE_OPERAND (bound, 0);
if (integer_onep (TREE_OPERAND (bound, 1)))
t = TREE_OPERAND (t, 0);
if (TREE_CODE (t) == VAR_DECL || TREE_CODE (t) == PARM_DECL)
{
add_AT_die_ref (subrange_die, DW_AT_count, lookup_decl_die (t));
return;
}
}
/* If optimization is turned on, the SAVE_EXPRs that describe how to /* If optimization is turned on, the SAVE_EXPRs that describe how to
access the upper bound values are essentially bogus. They only access the upper bound values may be bogus. If they refer to a
describe (at best) how to get at these values at the points in the register, they may only describe how to get at these values at the
generated code right after they have just been computed. Worse points in the generated code right after they have just been
yet, in the typical case, the upper bound values will not even computed. Worse yet, in the typical case, the upper bound values
*be* computed in the optimized code, so these SAVE_EXPRs are will not even *be* computed in the optimized code (though the
entirely bogus. In order to compensate for this fact, we check number of elements will), so these SAVE_EXPRs are entirely
here to see if optimization is enabled, and if so, we don't add an bogus. In order to compensate for this fact, we check here to see
attribute for the (unknown and unknowable) upper bound. This if optimization is enabled, and if so, we don't add an attribute
should not cause too much trouble for existing (stupid?) for the (unknown and unknowable) upper bound. This should not
debuggers because they have to deal with empty upper bounds cause too much trouble for existing (stupid?) debuggers because
location descriptions anyway in order to be able to deal with they have to deal with empty upper bounds location descriptions
incomplete array types. Of course an intelligent debugger (GDB?) anyway in order to be able to deal with incomplete array types.
should be able to comprehend that a missing upper bound Of course an intelligent debugger (GDB?) should be able to
specification in a array type used for a storage class `auto' comprehend that a missing upper bound specification in a array
local array variable indicates that the upper bound is both type used for a storage class `auto' local array variable
unknown (at compile- time) and unknowable (at run-time) due to indicates that the upper bound is both unknown (at compile- time)
optimization. */ and unknowable (at run-time) due to optimization.
if (!optimize)
We assume that a MEM rtx is safe because gcc wouldn't put the
value there unless it was going to be used repeatedly in the
function, i.e. for cleanups. */
if (! optimize || GET_CODE (SAVE_EXPR_RTL (bound)) == MEM)
{ {
bound_loc = mem_loc_descriptor register dw_die_ref ctx = lookup_decl_die (current_function_decl);
(eliminate_regs (SAVE_EXPR_RTL (bound), 0, NULL_RTX, 0)); register dw_die_ref decl_die = new_die (DW_TAG_variable, ctx);
add_AT_loc (subrange_die, bound_attr, bound_loc); add_AT_flag (decl_die, DW_AT_artificial, 1);
add_type_attribute (decl_die, TREE_TYPE (bound), 1, 0, ctx);
add_location_attribute (decl_die, SAVE_EXPR_RTL (bound));
add_AT_die_ref (subrange_die, bound_attr, decl_die);
} }
/* else leave out the attribute. */ /* else leave out the attribute. */
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment