From: Richard Biener Date: Mon, 9 Jan 2017 08:22:58 +0000 (+0000) Subject: re PR debug/79000 (ICE: in gen_member_die, at dwarf2out.c:23995) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=813b9c0d3a1b95c653bea8db73d7971ac600b68e;p=gcc.git re PR debug/79000 (ICE: in gen_member_die, at dwarf2out.c:23995) 2017-01-09 Richard Biener PR debug/79000 * dwarf2out.c (is_cxx): New overload with context. (is_naming_typedef_decl): Use it. * g++.dg/lto/pr79000_0.C: New testcase. * g++.dg/lto/pr79000_1.c: Likewise. From-SVN: r244217 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 87b3f8b258c..40ecb03d0dd 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-01-09 Richard Biener + + PR debug/79000 + * dwarf2out.c (is_cxx): New overload with context. + (is_naming_typedef_decl): Use it. + 2017-01-08 Sandra Loosemore * invoke.texi (Option Summary): Correct spacing in option lists diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 8abeb7abf65..9da69dfa2c6 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -3356,6 +3356,7 @@ static int get_AT_flag (dw_die_ref, enum dwarf_attribute); static unsigned get_AT_unsigned (dw_die_ref, enum dwarf_attribute); static inline dw_die_ref get_AT_ref (dw_die_ref, enum dwarf_attribute); static bool is_cxx (void); +static bool is_cxx (const_tree); static bool is_fortran (void); static bool is_ada (void); static bool remove_AT (dw_die_ref, enum dwarf_attribute); @@ -4990,6 +4991,27 @@ is_cxx (void) || lang == DW_LANG_C_plus_plus_11 || lang == DW_LANG_C_plus_plus_14); } +/* Return TRUE if DECL was created by the C++ frontend. */ + +static bool +is_cxx (const_tree decl) +{ + if (in_lto_p) + { + const_tree context = decl; + while (context && TREE_CODE (context) != TRANSLATION_UNIT_DECL) + { + if (TREE_CODE (context) == BLOCK) + context = BLOCK_SUPERCONTEXT (context); + else + context = get_containing_scope (context); + } + if (context && TRANSLATION_UNIT_LANGUAGE (context)) + return strncmp (TRANSLATION_UNIT_LANGUAGE (context), "GNU C++", 7) == 0; + } + return is_cxx (); +} + /* Return TRUE if the language is Java. */ static inline bool @@ -24762,7 +24784,7 @@ is_naming_typedef_decl (const_tree decl) /* It looks like Ada produces TYPE_DECLs that are very similar to C++ naming typedefs but that have different semantics. Let's be specific to c++ for now. */ - || !is_cxx ()) + || !is_cxx (decl)) return FALSE; return (DECL_ORIGINAL_TYPE (decl) == NULL_TREE diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fc3873578f6..51f3bf33959 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2017-01-09 Richard Biener + + PR debug/79000 + * g++.dg/lto/pr79000_0.C: New testcase. + * g++.dg/lto/pr79000_1.c: Likewise. + 2017-01-08 Martin Sebor PR middle-end/77708 diff --git a/gcc/testsuite/g++.dg/lto/pr79000_0.C b/gcc/testsuite/g++.dg/lto/pr79000_0.C new file mode 100644 index 00000000000..1d5c40ee7a5 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/pr79000_0.C @@ -0,0 +1,7 @@ +// { dg-lto-do link } +// { dg-lto-options { "-flto -g" } } +// { dg-extra-ld-options "-r -nostdlib" } + +struct a { + a(); +} b; diff --git a/gcc/testsuite/g++.dg/lto/pr79000_1.c b/gcc/testsuite/g++.dg/lto/pr79000_1.c new file mode 100644 index 00000000000..53389b9b979 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/pr79000_1.c @@ -0,0 +1,5 @@ +typedef struct a b; +typedef struct a { } b; +struct { + b c; +} d;