diff options
author | Jakub Jelinek <jakub@redhat.com> | 2010-05-25 18:15:38 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2010-05-25 18:15:38 +0200 |
commit | 60a5d78a724cc604ca54605db99cc62fcc82f53b (patch) | |
tree | ad9e7454c414627ffdd7dd66d6dfc5825128c0a9 /gcc/dwarf2out.c | |
parent | c946a318432341ea470c5f7540490a87823aaedd (diff) | |
download | gcc-60a5d78a724cc604ca54605db99cc62fcc82f53b.zip gcc-60a5d78a724cc604ca54605db99cc62fcc82f53b.tar.gz gcc-60a5d78a724cc604ca54605db99cc62fcc82f53b.tar.bz2 |
re PR debug/42801 (C VLAs should use DW_AT_allocated)
PR debug/42801
* tree-inline.c (remap_decls): Remap DECL_VALUE_EXPR here...
(copy_bind_expr): ... instead of here.
(copy_tree_body_r): If id->remapping_type_depth clear TREE_BLOCK
if the block hasn't been remapped.
* dwarf2out.c (gen_formal_parameter_die, gen_variable_die): When
emitting concrete instance of abstract VLA, add DW_AT_type attribute.
* gcc.dg/guality/sra-2.c: New test.
From-SVN: r159826
Diffstat (limited to 'gcc/dwarf2out.c')
-rw-r--r-- | gcc/dwarf2out.c | 48 |
1 files changed, 32 insertions, 16 deletions
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 19c322d..f77b948 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -17906,22 +17906,26 @@ gen_formal_parameter_die (tree node, tree origin, bool emit_name_p, origin = ultimate_origin; if (origin != NULL) add_abstract_origin_attribute (parm_die, origin); - else + else if (emit_name_p) + add_name_and_src_coords_attributes (parm_die, node); + if (origin == NULL + || (! DECL_ABSTRACT (node_or_origin) + && variably_modified_type_p (TREE_TYPE (node_or_origin), + decl_function_context + (node_or_origin)))) { - tree type = TREE_TYPE (node); - if (emit_name_p) - add_name_and_src_coords_attributes (parm_die, node); - if (decl_by_reference_p (node)) + tree type = TREE_TYPE (node_or_origin); + if (decl_by_reference_p (node_or_origin)) add_type_attribute (parm_die, TREE_TYPE (type), 0, 0, context_die); else add_type_attribute (parm_die, type, - TREE_READONLY (node), - TREE_THIS_VOLATILE (node), + TREE_READONLY (node_or_origin), + TREE_THIS_VOLATILE (node_or_origin), context_die); - if (DECL_ARTIFICIAL (node)) - add_AT_flag (parm_die, DW_AT_artificial, 1); } + if (origin == NULL && DECL_ARTIFICIAL (node)) + add_AT_flag (parm_die, DW_AT_artificial, 1); if (node && node != origin) equate_decl_number_to_die (node, parm_die); @@ -18624,8 +18628,9 @@ gen_variable_die (tree decl, tree origin, dw_die_ref context_die) dw_die_ref var_die; dw_die_ref old_die = decl ? lookup_decl_die (decl) : NULL; dw_die_ref origin_die; - int declaration = (DECL_EXTERNAL (decl_or_origin) - || class_or_namespace_scope_p (context_die)); + bool declaration = (DECL_EXTERNAL (decl_or_origin) + || class_or_namespace_scope_p (context_die)); + bool specialization_p = false; ultimate_origin = decl_ultimate_origin (decl_or_origin); if (decl || ultimate_origin) @@ -18769,6 +18774,7 @@ gen_variable_die (tree decl, tree origin, dw_die_ref context_die) { /* This is a definition of a C++ class level static. */ add_AT_specification (var_die, old_die); + specialization_p = true; if (DECL_NAME (decl)) { expanded_location s = expand_location (DECL_SOURCE_LOCATION (decl)); @@ -18782,16 +18788,26 @@ gen_variable_die (tree decl, tree origin, dw_die_ref context_die) } } else + add_name_and_src_coords_attributes (var_die, decl); + + if ((origin == NULL && !specialization_p) + || (origin != NULL + && !DECL_ABSTRACT (decl_or_origin) + && variably_modified_type_p (TREE_TYPE (decl_or_origin), + decl_function_context + (decl_or_origin)))) { - tree type = TREE_TYPE (decl); + tree type = TREE_TYPE (decl_or_origin); - add_name_and_src_coords_attributes (var_die, decl); - if (decl_by_reference_p (decl)) + if (decl_by_reference_p (decl_or_origin)) add_type_attribute (var_die, TREE_TYPE (type), 0, 0, context_die); else - add_type_attribute (var_die, type, TREE_READONLY (decl), - TREE_THIS_VOLATILE (decl), context_die); + add_type_attribute (var_die, type, TREE_READONLY (decl_or_origin), + TREE_THIS_VOLATILE (decl_or_origin), context_die); + } + if (origin == NULL && !specialization_p) + { if (TREE_PUBLIC (decl)) add_AT_flag (var_die, DW_AT_external, 1); |