summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2018-07-16 11:57:10 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2018-07-16 11:57:10 +0000
commit58a930f8e5a39d133d3efdb2c2f49defef892636 (patch)
treebc9ee570959e47eced2bf7e437c7ce9f10259463
parenta453afd16de79f7c6e96246c698e402ec34f932f (diff)
2018-07-19 Richard Biener <rguenther@suse.de>
Backport from mainline 2018-07-13 Richard Biener <rguenther@suse.de> PR debug/86452 * dwarf2out.c (gen_type_die_with_usage): Use scope_die_for instead of get_context_die. 2018-07-12 Richard Biener <rguenther@suse.de> PR c/86453 * c-attribs.c (handle_packed_attribute): Do not build a variant type with TYPE_PACKED, instead ignore the attribute if we may not apply to the original type. * g++.dg/warn/pr86453.C: New testcase. 2018-07-11 Richard Biener <rguenther@suse.de> PR debug/86457 * dwarf2out.c (init_sections_and_labels): Use output_asm_line_debug_info consistently. (dwarf2out_early_finish): Likewise. (dwarf2out_finish): Remove DW_AT_stmt_list from early generated type units. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@262691 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog18
-rw-r--r--gcc/c-family/ChangeLog10
-rw-r--r--gcc/c-family/c-attribs.c9
-rw-r--r--gcc/dwarf2out.c17
-rw-r--r--gcc/testsuite/ChangeLog8
-rw-r--r--gcc/testsuite/g++.dg/warn/pr86453.C5
6 files changed, 55 insertions, 12 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 51a78594966f..d37fcac446ed 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,21 @@
+2018-07-19 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2018-07-13 Richard Biener <rguenther@suse.de>
+
+ PR debug/86452
+ * dwarf2out.c (gen_type_die_with_usage): Use scope_die_for
+ instead of get_context_die.
+
+ 2018-07-11 Richard Biener <rguenther@suse.de>
+
+ PR debug/86457
+ * dwarf2out.c (init_sections_and_labels): Use
+ output_asm_line_debug_info consistently.
+ (dwarf2out_early_finish): Likewise.
+ (dwarf2out_finish): Remove DW_AT_stmt_list from early generated
+ type units.
+
2018-07-16 Richard Biener <rguenther@suse.de>
Backport from mainline
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 5dda769f7733..3f984529aa9a 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,13 @@
+2018-07-19 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2018-07-12 Richard Biener <rguenther@suse.de>
+
+ PR c/86453
+ * c-attribs.c (handle_packed_attribute): Do not build a variant
+ type with TYPE_PACKED, instead ignore the attribute if we may
+ not apply to the original type.
+
2018-07-12 Jakub Jelinek <jakub@redhat.com>
* c-attribs.c (c_common_attribute_table): Add
diff --git a/gcc/c-family/c-attribs.c b/gcc/c-family/c-attribs.c
index 9ac9d3587948..c9e799e0fcdd 100644
--- a/gcc/c-family/c-attribs.c
+++ b/gcc/c-family/c-attribs.c
@@ -519,8 +519,13 @@ handle_packed_attribute (tree *node, tree name, tree ARG_UNUSED (args),
if (TYPE_P (*node))
{
if (!(flags & (int) ATTR_FLAG_TYPE_IN_PLACE))
- *node = build_variant_type_copy (*node);
- TYPE_PACKED (*node) = 1;
+ {
+ warning (OPT_Wattributes,
+ "%qE attribute ignored for type %qT", name, *node);
+ *no_add_attrs = true;
+ }
+ else
+ TYPE_PACKED (*node) = 1;
}
else if (TREE_CODE (*node) == FIELD_DECL)
{
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 0c5d7e0e0357..d94cf7dc9285 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -25378,11 +25378,8 @@ gen_type_die_with_usage (tree type, dw_die_ref context_die,
generate debug info for the typedef. */
if (is_naming_typedef_decl (TYPE_NAME (type)))
{
- /* Use the DIE of the containing namespace as the parent DIE of
- the type description DIE we want to generate. */
- if (DECL_CONTEXT (TYPE_NAME (type))
- && TREE_CODE (DECL_CONTEXT (TYPE_NAME (type))) == NAMESPACE_DECL)
- context_die = get_context_die (DECL_CONTEXT (TYPE_NAME (type)));
+ /* Give typedefs the right scope. */
+ context_die = scope_die_for (type, context_die);
gen_decl_die (TYPE_NAME (type), NULL, NULL, context_die);
return;
@@ -28475,7 +28472,7 @@ init_sections_and_labels (bool early_lto_debug)
debug_str_section = get_section (DEBUG_LTO_STR_SECTION,
DEBUG_STR_SECTION_FLAGS
| SECTION_EXCLUDE, NULL);
- if (!dwarf_split_debug_info && !dwarf2out_as_loc_support)
+ if (!dwarf_split_debug_info && !output_asm_line_debug_info ())
debug_line_str_section
= get_section (DEBUG_LTO_LINE_STR_SECTION,
DEBUG_STR_SECTION_FLAGS | SECTION_EXCLUDE, NULL);
@@ -31058,9 +31055,9 @@ dwarf2out_finish (const char *)
if (*slot != HTAB_EMPTY_ENTRY)
continue;
- /* Add a pointer to the line table for the main compilation unit
- so that the debugger can make sense of DW_AT_decl_file
- attributes. */
+ /* Remove the pointer to the line table. */
+ remove_AT (ctnode->root_die, DW_AT_stmt_list);
+
if (debug_info_level >= DINFO_LEVEL_TERSE)
reset_dies (ctnode->root_die);
@@ -31724,7 +31721,7 @@ dwarf2out_early_finish (const char *filename)
/* When emitting DWARF5 .debug_line_str, move DW_AT_name and
DW_AT_comp_dir into .debug_line_str section. */
- if (!dwarf2out_as_loc_support
+ if (!output_asm_line_debug_info ()
&& dwarf_version >= 5
&& DWARF5_USE_DEBUG_LINE_STR)
{
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 5fcbc58b6662..b8bc37428e77 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2018-07-19 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2018-07-12 Richard Biener <rguenther@suse.de>
+
+ PR c/86453
+ * g++.dg/warn/pr86453.C: New testcase.
+
2018-07-16 Richard Biener <rguenther@suse.de>
Backport from mainline
diff --git a/gcc/testsuite/g++.dg/warn/pr86453.C b/gcc/testsuite/g++.dg/warn/pr86453.C
new file mode 100644
index 000000000000..318f406b03d8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/pr86453.C
@@ -0,0 +1,5 @@
+// { dg-do compile }
+// { dg-additional-options "-flto" { target lto } }
+struct X {
+ int *__attribute__((aligned(2), packed)) a; // { dg-warning "attribute ignored" }
+} b;