summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog51
-rw-r--r--gcc/c-opts.c12
-rw-r--r--gcc/c.opt12
-rw-r--r--gcc/cp/cp-lang.c2
-rw-r--r--gcc/cp/cp-tree.h1
-rw-r--r--gcc/cp/tree.c8
-rw-r--r--gcc/doc/invoke.texi74
-rw-r--r--gcc/dwarf2out.c44
-rw-r--r--gcc/flags.h20
-rw-r--r--gcc/langhooks-def.h2
-rw-r--r--gcc/langhooks.h4
-rw-r--r--gcc/opts.c254
-rw-r--r--gcc/testsuite/ChangeLog26
-rw-r--r--gcc/testsuite/g++.dg/other/fesd-any.C126
-rw-r--r--gcc/testsuite/g++.dg/other/fesd-any.h42
-rw-r--r--gcc/testsuite/g++.dg/other/fesd-baseonly.C126
-rw-r--r--gcc/testsuite/g++.dg/other/fesd-baseonly.h42
-rw-r--r--gcc/testsuite/g++.dg/other/fesd-none.C126
-rw-r--r--gcc/testsuite/g++.dg/other/fesd-none.h42
-rw-r--r--gcc/testsuite/g++.dg/other/fesd-reduced.C126
-rw-r--r--gcc/testsuite/g++.dg/other/fesd-reduced.h42
-rw-r--r--gcc/testsuite/g++.dg/other/fesd-sys.C126
-rw-r--r--gcc/testsuite/g++.dg/other/fesd-sys.h42
-rw-r--r--gcc/testsuite/g++.dg/other/fesd.h67
-rw-r--r--gcc/testsuite/gcc.dg/fesd-any.c84
-rw-r--r--gcc/testsuite/gcc.dg/fesd-any.h19
-rw-r--r--gcc/testsuite/gcc.dg/fesd-baseonly.c83
-rw-r--r--gcc/testsuite/gcc.dg/fesd-baseonly.h19
-rw-r--r--gcc/testsuite/gcc.dg/fesd-none.c84
-rw-r--r--gcc/testsuite/gcc.dg/fesd-none.h19
-rw-r--r--gcc/testsuite/gcc.dg/fesd-reduced.c83
-rw-r--r--gcc/testsuite/gcc.dg/fesd-reduced.h19
-rw-r--r--gcc/testsuite/gcc.dg/fesd-sys.c83
-rw-r--r--gcc/testsuite/gcc.dg/fesd-sys.h19
-rw-r--r--gcc/testsuite/gcc.dg/fesd.h36
35 files changed, 1955 insertions, 10 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 2003af8c521..5cf9903435f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,54 @@
+2007-04-16 Lawrence Crowl <crowl@google.com>
+
+ * doc/invoke.texi (Debugging Options): Add documentation for the
+ -femit-struct-debug options -femit-struct-debug-baseonly,
+ -femit-struct-debug-reduced, and
+ -femit-struct-debug-detailed[=...].
+
+ * c-opts.c (c_common_handle_option): Add
+ OPT_femit_struct_debug_baseonly, OPT_femit_struct_debug_reduced,
+ and OPT_femit_struct_debug_detailed_.
+ * c.opt: Add specifications for
+ -femit-struct-debug-baseonly, -femit-struct-debug-reduced,
+ and -femit-struct-debug-detailed[=...].
+ * opts.c (set_struct_debug_option): Parse the
+ -femit-struct-debug-... options.
+ * opts.c (matches_main_base, main_input_basename,
+ main_input_baselength, base_of_path, matches_main_base): Add
+ variables and functions to compare header base name to compilation
+ unit base name.
+ * opts.c (should_emit_struct_debug): Add to determine to emit a
+ structure based on the option.
+ (dump_struct_debug) Also disabled function to debug this
+ function.
+ * opts.c (handle_options): Save the base name of the
+ compilation unit.
+
+ * langhooks-def.h (LANG_HOOKS_GENERIC_TYPE_P): Define.
+ (LANG_HOOKS_FOR_TYPES_INITIALIZER): Add.
+ This hook indicates if a type is generic. Set it by default
+ to "never generic".
+ * langhooks.h (struct lang_hooks_for_types): Add a new hook
+ to determine if a struct type is generic or not.
+ * cp/cp-tree.h (class_tmpl_impl_spec_p): Declare a C++ hook.
+ * cp/tree.c (class_tmpl_impl_spec_p): Implement the C++ hook.
+ * cp/cp-lang.c (LANG_HOOKS_GENERIC_TYPE_P): Override null C hook
+ with live C++ hook.
+
+ * flags.h (enum debug_info_usage): Add an enumeration to describe
+ a program's use of a structure type.
+ * dwarf2out.c (gen_struct_or_union_type_die): Add a new parameter
+ to indicate the program's usage of the type. Filter structs based
+ on the -femit-struct-debug-... specification.
+ (gen_type_die): Split into two routines, gen_type_die and
+ gen_type_die_with_usage. gen_type_die is now a wrapper
+ that assumes direct usage.
+ (gen_type_die_with_usage): Replace calls to gen_type_die
+ with gen_type_die_with_usage adding the program usage of
+ the referenced type.
+ (dwarf2out_imported_module_or_decl): Suppress struct debug
+ information using should_emit_struct_debug when appropriate.
+
2007-04-16 Ian Lance Taylor <iant@google.com>
PR tree-optimization/31522
diff --git a/gcc/c-opts.c b/gcc/c-opts.c
index 2130c7d7e75..e378f377a0c 100644
--- a/gcc/c-opts.c
+++ b/gcc/c-opts.c
@@ -832,6 +832,18 @@ c_common_handle_option (size_t scode, const char *arg, int value)
flag_gen_declaration = 1;
break;
+ case OPT_femit_struct_debug_baseonly:
+ set_struct_debug_option ("base");
+ break;
+
+ case OPT_femit_struct_debug_reduced:
+ set_struct_debug_option ("dir:ord:sys,dir:gen:any,ind:base");
+ break;
+
+ case OPT_femit_struct_debug_detailed_:
+ set_struct_debug_option (arg);
+ break;
+
case OPT_idirafter:
add_path (xstrdup (arg), AFTER, 0, true);
break;
diff --git a/gcc/c.opt b/gcc/c.opt
index 9af480355b1..c76b3b4aa17 100644
--- a/gcc/c.opt
+++ b/gcc/c.opt
@@ -791,6 +791,18 @@ gen-decls
ObjC ObjC++
Dump declarations to a .decl file
+femit-struct-debug-baseonly
+C ObjC C++ ObjC++
+-femit-struct-debug-baseonly Aggressive reduced debug info for structs
+
+femit-struct-debug-reduced
+C ObjC C++ ObjC++
+-femit-struct-debug-reduced Conservative reduced debug info for structs
+
+femit-struct-debug-detailed=
+C ObjC C++ ObjC++ Joined
+-femit-struct-debug-detailed=<spec-list> Detailed reduced debug info for structs
+
idirafter
C ObjC C++ ObjC++ Joined Separate
-idirafter <dir> Add <dir> to the end of the system include path
diff --git a/gcc/cp/cp-lang.c b/gcc/cp/cp-lang.c
index 507641c36bd..d898cf196ed 100644
--- a/gcc/cp/cp-lang.c
+++ b/gcc/cp/cp-lang.c
@@ -45,6 +45,8 @@ static const char * cxx_dwarf_name (tree t, int verbosity);
#define LANG_HOOKS_NAME "GNU C++"
#undef LANG_HOOKS_INIT
#define LANG_HOOKS_INIT cxx_init
+#undef LANG_HOOKS_GENERIC_TYPE_P
+#define LANG_HOOKS_GENERIC_TYPE_P class_tmpl_impl_spec_p
#undef LANG_HOOKS_DECL_PRINTABLE_NAME
#define LANG_HOOKS_DECL_PRINTABLE_NAME cxx_printable_name
#undef LANG_HOOKS_DWARF_NAME
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 07e4e3f1ec2..e4e847328f3 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -4632,6 +4632,7 @@ extern tree add_stmt_to_compound (tree, tree);
extern tree cxx_maybe_build_cleanup (tree);
extern void init_tree (void);
extern int pod_type_p (tree);
+extern bool class_tmpl_impl_spec_p (tree);
extern int zero_init_p (tree);
extern tree canonical_type_variant (tree);
extern tree copy_binfo (tree, tree, tree,
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index a8ff6f60670..848c3407673 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -2007,6 +2007,14 @@ pod_type_p (tree t)
return 1;
}
+/* Nonzero iff type T is a class template implicit specialization. */
+
+bool
+class_tmpl_impl_spec_p (tree t)
+{
+ return CLASS_TYPE_P (t) && CLASSTYPE_TEMPLATE_INSTANTIATION (t);
+}
+
/* Returns 1 iff zero initialization of type T means actually storing
zeros in it. */
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 842dcbfcbce..d1523db29de 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -300,6 +300,8 @@ Objective-C and Objective-C++ Dialects}.
-ftest-coverage -ftime-report -fvar-tracking @gol
-g -g@var{level} -gcoff -gdwarf-2 @gol
-ggdb -gstabs -gstabs+ -gvms -gxcoff -gxcoff+ @gol
+-femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
+-femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
-p -pg -print-file-name=@var{library} -print-libgcc-file-name @gol
-print-multi-directory -print-multi-lib @gol
-print-prog-name=@var{program} -print-search-dirs -Q @gol
@@ -3967,6 +3969,78 @@ Compress DWARF2 debugging information by eliminating duplicated
information about each symbol. This option only makes sense when
generating DWARF2 debugging information with @option{-gdwarf-2}.
+@item -femit-struct-debug-baseonly
+Emit debug information for struct-like types
+only when the base name of the compilation source file
+matches the base name of file in which the struct was defined.
+
+This option substantially reduces the size of debugging information,
+but at significant potential loss in type information to the debugger.
+See @option{-femit-struct-debug-reduced} for a less aggressive option.
+See @option{-femit-struct-debug-detailed} for more detailed control.
+
+This option works only with DWARF 2.
+
+@item -femit-struct-debug-reduced
+Emit debug information for struct-like types
+only when the base name of the compilation source file
+matches the base name of file in which the type was defined,
+unless the struct is a template or defined in a system header.
+
+This option significantly reduces the size of debugging information,
+with some potential loss in type information to the debugger.
+See @option{-femit-struct-debug-baseonly} for a more aggressive option.
+See @option{-femit-struct-debug-detailed} for more detailed control.
+
+This option works only with DWARF 2.
+
+@item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
+Specify the struct-like types
+for which the compiler will generate debug information.
+The intent is to reduce duplicate struct debug information
+between different object files within the same program.
+
+This option is a detailed version of
+@option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
+which will serve for most needs.
+
+A specification has the syntax
+[@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
+
+The optional first word limits the specification to
+structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
+A struct type is used directly when it is the type of a variable, member.
+Indirect uses arise through pointers to structs.
+That is, when use of an incomplete struct would be legal, the use is indirect.
+An example is
+@samp{struct one direct; struct two * indirect;}.
+
+The optional second word limits the specification to
+ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
+Generic structs are a bit complicated to explain.
+For C++, these are non-explicit specializations of template classes,
+or non-template classes within the above.
+Other programming languages have generics,
+but @samp{-femit-struct-debug-detailed} does not yet implement them.
+
+The third word specifies the source files for those
+structs for which the compiler will emit debug information.
+The values @samp{none} and @samp{any} have the normal meaning.
+The value @samp{base} means that
+the base of name of the file in which the type declaration appears
+must match the base of the name of the main compilation file.
+In practice, this means that
+types declared in @file{foo.c} and @file{foo.h} will have debug information,
+but types declared in other header will not.
+The value @samp{sys} means those types satisfying @samp{base}
+or declared in system or compiler headers.
+
+You may need to experiment to determine the best settings for your application.
+
+The default is @samp{-femit-struct-debug-detailed=all}.
+
+This option works only with DWARF 2.
+
@cindex @command{prof}
@item -p
@opindex p
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index cbaf0637c7d..bb70c291334 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -4236,7 +4236,8 @@ static void gen_ptr_to_mbr_type_die (tree, dw_die_ref);
static dw_die_ref gen_compile_unit_die (const char *);
static void gen_inheritance_die (tree, tree, dw_die_ref);
static void gen_member_die (tree, dw_die_ref);
-static void gen_struct_or_union_type_die (tree, dw_die_ref);
+static void gen_struct_or_union_type_die (tree, dw_die_ref,
+ enum debug_info_usage);
static void gen_subroutine_type_die (tree, dw_die_ref);
static void gen_typedef_die (tree, dw_die_ref);
static void gen_type_die (tree, dw_die_ref);
@@ -12604,7 +12605,8 @@ gen_member_die (tree type, dw_die_ref context_die)
member DIEs needed by later specification DIEs. */
static void
-gen_struct_or_union_type_die (tree type, dw_die_ref context_die)
+gen_struct_or_union_type_die (tree type, dw_die_ref context_die,
+ enum debug_info_usage usage)
{
dw_die_ref type_die = lookup_type_die (type);
dw_die_ref scope_die = 0;
@@ -12613,6 +12615,7 @@ gen_struct_or_union_type_die (tree type, dw_die_ref context_die)
&& (! TYPE_STUB_DECL (type)
|| ! TYPE_DECL_SUPPRESS_DEBUG (TYPE_STUB_DECL (type))));
int ns_decl = (context_die && context_die->die_tag == DW_TAG_namespace);
+ complete = complete && should_emit_struct_debug (type, usage);
if (type_die && ! complete)
return;
@@ -12749,7 +12752,8 @@ gen_typedef_die (tree decl, dw_die_ref context_die)
/* Generate a type description DIE. */
static void
-gen_type_die (tree type, dw_die_ref context_die)
+gen_type_die_with_usage (tree type, dw_die_ref context_die,
+ enum debug_info_usage usage)
{
int need_pop;
@@ -12797,16 +12801,19 @@ gen_type_die (tree type, dw_die_ref context_die)
/* For these types, all that is required is that we output a DIE (or a
set of DIEs) to represent the "basis" type. */
- gen_type_die (TREE_TYPE (type), context_die);
+ gen_type_die_with_usage (TREE_TYPE (type), context_die,
+ DINFO_USAGE_IND_USE);
break;
case OFFSET_TYPE:
/* This code is used for C++ pointer-to-data-member types.
Output a description of the relevant class type. */
- gen_type_die (TYPE_OFFSET_BASETYPE (type), context_die);
+ gen_type_die_with_usage (TYPE_OFFSET_BASETYPE (type), context_die,
+ DINFO_USAGE_IND_USE);
/* Output a description of the type of the object pointed to. */
- gen_type_die (TREE_TYPE (type), context_die);
+ gen_type_die_with_usage (TREE_TYPE (type), context_die,
+ DINFO_USAGE_IND_USE);
/* Now output a DIE to represent this pointer-to-data-member type
itself. */
@@ -12815,13 +12822,15 @@ gen_type_die (tree type, dw_die_ref context_die)
case FUNCTION_TYPE:
/* Force out return type (in case it wasn't forced out already). */
- gen_type_die (TREE_TYPE (type), context_die);
+ gen_type_die_with_usage (TREE_TYPE (type), context_die,
+ DINFO_USAGE_DIR_USE);
gen_subroutine_type_die (type, context_die);
break;
case METHOD_TYPE:
/* Force out return type (in case it wasn't forced out already). */
- gen_type_die (TREE_TYPE (type), context_die);
+ gen_type_die_with_usage (TREE_TYPE (type), context_die,
+ DINFO_USAGE_DIR_USE);
gen_subroutine_type_die (type, context_die);
break;
@@ -12847,7 +12856,7 @@ gen_type_die (tree type, dw_die_ref context_die)
&& AGGREGATE_TYPE_P (TYPE_CONTEXT (type))
&& ! TREE_ASM_WRITTEN (TYPE_CONTEXT (type)))
{
- gen_type_die (TYPE_CONTEXT (type), context_die);
+ gen_type_die_with_usage (TYPE_CONTEXT (type), context_die, usage);
if (TREE_ASM_WRITTEN (type))
return;
@@ -12871,7 +12880,7 @@ gen_type_die (tree type, dw_die_ref context_die)
gen_enumeration_type_die (type, context_die);
}
else
- gen_struct_or_union_type_die (type, context_die);
+ gen_struct_or_union_type_die (type, context_die, usage);
if (need_pop)
pop_decl_scope ();
@@ -12900,6 +12909,12 @@ gen_type_die (tree type, dw_die_ref context_die)
TREE_ASM_WRITTEN (type) = 1;
}
+static void
+gen_type_die (tree type, dw_die_ref context_die)
+{
+ gen_type_die_with_usage (type, context_die, DINFO_USAGE_DIR_USE);
+}
+
/* Generate a DIE for a tagged type instantiation. */
static void
@@ -13496,7 +13511,11 @@ dwarf2out_imported_module_or_decl (tree decl, tree context)
if (!context)
scope_die = comp_unit_die;
else if (TYPE_P (context))
+ {
+ if (!should_emit_struct_debug (context, DINFO_USAGE_DIR_USE))
+ return;
scope_die = force_type_die (context);
+ }
else
scope_die = force_decl_die (context);
@@ -13522,7 +13541,12 @@ dwarf2out_imported_module_or_decl (tree decl, tree context)
if (TYPE_CONTEXT (type))
if (TYPE_P (TYPE_CONTEXT (type)))
+ {
+ if (!should_emit_struct_debug (TYPE_CONTEXT (type),
+ DINFO_USAGE_DIR_USE))
+ return;
type_context_die = force_type_die (TYPE_CONTEXT (type));
+ }
else
type_context_die = force_decl_die (TYPE_CONTEXT (type));
else
diff --git a/gcc/flags.h b/gcc/flags.h
index 0b594ee48d3..98396f04091 100644
--- a/gcc/flags.h
+++ b/gcc/flags.h
@@ -23,6 +23,7 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
#ifndef GCC_FLAGS_H
#define GCC_FLAGS_H
+#include "coretypes.h"
#include "options.h"
enum debug_info_type
@@ -54,6 +55,25 @@ enum debug_info_level
/* Specify how much debugging info to generate. */
extern enum debug_info_level debug_info_level;
+/* A major contribution to object and executable size is debug
+ information size. A major contribution to debug information
+ size is struct descriptions replicated in several object files.
+ The following function determines whether or not debug information
+ should be generated for a given struct. The indirect parameter
+ indicates that the struct is being handled indirectly, via
+ a pointer. See opts.c for the implementation. */
+
+enum debug_info_usage
+{
+ DINFO_USAGE_DFN, /* A struct definition. */
+ DINFO_USAGE_DIR_USE, /* A direct use, such as the type of a variable. */
+ DINFO_USAGE_IND_USE, /* An indirect use, such as through a pointer. */
+ DINFO_USAGE_NUM_ENUMS /* The number of enumerators. */
+};
+
+extern bool should_emit_struct_debug (tree type_decl, enum debug_info_usage);
+extern void set_struct_debug_option (const char *value);
+
/* Nonzero means use GNU-only extensions in the generated symbolic
debugging information. */
extern bool use_gnu_debug_info_extensions;
diff --git a/gcc/langhooks-def.h b/gcc/langhooks-def.h
index 7a98a8afc16..c2d5bc2e22c 100644
--- a/gcc/langhooks-def.h
+++ b/gcc/langhooks-def.h
@@ -199,6 +199,7 @@ extern tree lhd_make_node (enum tree_code);
so we create a compile-time error instead. */
#define LANG_HOOKS_MAKE_TYPE lhd_make_node
#define LANG_HOOKS_INCOMPLETE_TYPE_ERROR lhd_incomplete_type_error
+#define LANG_HOOKS_GENERIC_TYPE_P hook_bool_tree_false
#define LANG_HOOKS_TYPE_PROMOTES_TO lhd_type_promotes_to
#define LANG_HOOKS_REGISTER_BUILTIN_TYPE lhd_register_builtin_type
#define LANG_HOOKS_TYPE_MAX_SIZE lhd_return_null_tree
@@ -213,6 +214,7 @@ extern tree lhd_make_node (enum tree_code);
LANG_HOOKS_UNSIGNED_TYPE, \
LANG_HOOKS_SIGNED_TYPE, \
LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE, \
+ LANG_HOOKS_GENERIC_TYPE_P, \
LANG_HOOKS_TYPE_PROMOTES_TO, \
LANG_HOOKS_REGISTER_BUILTIN_TYPE, \
LANG_HOOKS_INCOMPLETE_TYPE_ERROR, \
diff --git a/gcc/langhooks.h b/gcc/langhooks.h
index f7aae186cac..3e38f2653bd 100644
--- a/gcc/langhooks.h
+++ b/gcc/langhooks.h
@@ -115,6 +115,10 @@ struct lang_hooks_for_types
according to UNSIGNEDP. */
tree (*signed_or_unsigned_type) (int, tree);
+ /* True if the type is an instantiation of a generic type,
+ e.g. C++ template implicit specializations. */
+ bool (*generic_p) (tree);
+
/* Given a type, apply default promotions to unnamed function
arguments and return the new type. Return the same type if no
change. Required by any language that supports variadic
diff --git a/gcc/opts.c b/gcc/opts.c
index 195e4e18c3c..0c4a1627e85 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -77,6 +77,256 @@ enum debug_info_type write_symbols = NO_DEBUG;
the definitions of the different possible levels. */
enum debug_info_level debug_info_level = DINFO_LEVEL_NONE;
+/* A major contribution to object and executable size is debug
+ information size. A major contribution to debug information size
+ is struct descriptions replicated in several object files. The
+ following flags attempt to reduce this information. The basic
+ idea is to not emit struct debugging information in the current
+ compilation unit when that information will be generated by
+ another compilation unit.
+
+ Debug information for a struct defined in the current source
+ file should be generated in the object file. Likewise the
+ debug information for a struct defined in a header should be
+ generated in the object file of the corresponding source file.
+ Both of these case are handled when the base name of the file of
+ the struct definition matches the base name of the source file
+ of thet current compilation unit. This matching emits minimal
+ struct debugging information.
+
+ The base file name matching rule above will fail to emit debug
+ information for structs defined in system headers. So a second
+ category of files includes system headers in addition to files
+ with matching bases.
+
+ The remaining types of files are library headers and application
+ headers. We cannot currently distinguish these two types. */
+
+enum debug_struct_file
+{
+ DINFO_STRUCT_FILE_NONE, /* Debug no structs. */
+ DINFO_STRUCT_FILE_BASE, /* Debug structs defined in files with the
+ same base name as the compilation unit. */
+ DINFO_STRUCT_FILE_SYS, /* Also debug structs defined in system
+ header files. */
+ DINFO_STRUCT_FILE_ANY /* Debug structs defined in all files. */
+};
+
+/* Generic structs (e.g. templates not explicitly specialized)
+ may not have a compilation unit associated with them, and so
+ may need to be treated differently from ordinary structs.
+
+ Structs only handled by reference (indirectly), will also usually
+ not need as much debugging information. */
+
+static enum debug_struct_file debug_struct_ordinary[DINFO_USAGE_NUM_ENUMS]
+ = { DINFO_STRUCT_FILE_ANY, DINFO_STRUCT_FILE_ANY, DINFO_STRUCT_FILE_ANY };
+static enum debug_struct_file debug_struct_generic[DINFO_USAGE_NUM_ENUMS]
+ = { DINFO_STRUCT_FILE_ANY, DINFO_STRUCT_FILE_ANY, DINFO_STRUCT_FILE_ANY };
+
+/* Parse the -femit-struct-debug-detailed option value
+ and set the flag variables. */
+
+#define MATCH( prefix, string ) \
+ ((strncmp (prefix, string, sizeof prefix - 1) == 0) \
+ ? ((string += sizeof prefix - 1), 1) : 0)
+
+void
+set_struct_debug_option (const char *spec)
+{
+ /* various labels for comparison */
+ static char dfn_lbl[] = "dfn:", dir_lbl[] = "dir:", ind_lbl[] = "ind:";
+ static char ord_lbl[] = "ord:", gen_lbl[] = "gen:";
+ static char none_lbl[] = "none", any_lbl[] = "any";
+ static char base_lbl[] = "base", sys_lbl[] = "sys";
+
+ enum debug_struct_file files = DINFO_STRUCT_FILE_ANY;
+ /* Default is to apply to as much as possible. */
+ enum debug_info_usage usage = DINFO_USAGE_NUM_ENUMS;
+ int ord = 1, gen = 1;
+
+ /* What usage? */
+ if (MATCH (dfn_lbl, spec))
+ usage = DINFO_USAGE_DFN;
+ else if (MATCH (dir_lbl, spec))
+ usage = DINFO_USAGE_DIR_USE;
+ else if (MATCH (ind_lbl, spec))
+ usage = DINFO_USAGE_IND_USE;
+
+ /* Generics or not? */
+ if (MATCH (ord_lbl, spec))
+ gen = 0;
+ else if (MATCH (gen_lbl, spec))
+ ord = 0;
+
+ /* What allowable environment? */
+ if (MATCH (none_lbl, spec))
+ files = DINFO_STRUCT_FILE_NONE;
+ else if (MATCH (any_lbl, spec))
+ files = DINFO_STRUCT_FILE_ANY;
+ else if (MATCH (sys_lbl, spec))
+ files = DINFO_STRUCT_FILE_SYS;
+ else if (MATCH (base_lbl, spec))
+ files = DINFO_STRUCT_FILE_BASE;
+ else
+ error ("argument %qs to %<-femit-struct-debug-detailed%> not recognized",
+ spec);
+
+ /* Effect the specification. */
+ if (usage == DINFO_USAGE_NUM_ENUMS)
+ {
+ if (ord)
+ {
+ debug_struct_ordinary[DINFO_USAGE_DFN] = files;
+ debug_struct_ordinary[DINFO_USAGE_DIR_USE] = files;
+ debug_struct_ordinary[DINFO_USAGE_IND_USE] = files;
+ }
+ if (gen)
+ {
+ debug_struct_generic[DINFO_USAGE_DFN] = files;
+ debug_struct_generic[DINFO_USAGE_DIR_USE] = files;
+ debug_struct_generic[DINFO_USAGE_IND_USE] = files;
+ }
+ }
+ else
+ {
+ if (ord)
+ debug_struct_ordinary[usage] = files;
+ if (gen)
+ debug_struct_generic[usage] = files;
+ }
+
+ if (*spec == ',')
+ set_struct_debug_option (spec+1);
+ else
+ {
+ /* No more -femit-struct-debug-detailed specifications.
+ Do final checks. */
+ if (*spec != '\0')
+ error ("argument %qs to %<-femit-struct-debug-detailed%> unknown",
+ spec);
+ if (debug_struct_ordinary[DINFO_USAGE_DIR_USE]
+ < debug_struct_ordinary[DINFO_USAGE_IND_USE]
+ || debug_struct_generic[DINFO_USAGE_DIR_USE]
+ < debug_struct_generic[DINFO_USAGE_IND_USE])
+ error ("%<-femit-struct-debug-detailed=dir:...%> must allow at least"
+ " as much as %<-femit-struct-debug-detailed=ind:...%>");
+ }
+}
+
+/* Find the base name of a path, stripping off both directories and
+ a single final extension. */
+static int
+base_of_path (const char *path, const char **base_out)
+{
+ const char *base = path;
+ const char *dot = 0;
+ const char *p = path;
+ char c = *p;
+ while (c)
+ {
+ if (IS_DIR_SEPARATOR(c))
+ {
+ base = p + 1;
+ dot = 0;
+ }
+ else if (c == '.')
+ dot = p;
+ c = *++p;
+ }
+ if (!dot)
+ dot = p;
+ *base_out = base;
+ return dot - base;
+}
+
+/* Match the base name of a file to the base name of a compilation unit. */
+
+static const char *main_input_basename;
+static int main_input_baselength;
+
+static int
+matches_main_base (const char *path)
+{
+ /* Cache the last query. */
+ static const char *last_path = NULL;
+ static int last_match = 0;
+ if (path != last_path)
+ {
+ const char *base;
+ int length = base_of_path (path, &base);
+ last_path = path;
+ last_match = (length == main_input_baselength
+ && memcmp (base, main_input_basename, length) == 0);
+ }
+ return last_match;
+}
+
+#ifdef DEBUG_DEBUG_STRUCT
+
+static int
+dump_struct_debug (tree type, enum debug_info_usage usage,
+ enum debug_struct_file criterion, int generic,
+ int matches, int result)
+{
+ /* Find the type name. */
+ tree type_decl = TYPE_STUB_DECL (type);
+ tree t = type_decl;
+ const char *name = 0;
+ if (TREE_CODE (t) == TYPE_DECL)
+ t = DECL_NAME (t);
+ if (t)
+ name = IDENTIFIER_POINTER (t);
+
+ fprintf (stderr, " struct %d %s %s %s %s %d %p %s\n",
+ criterion,
+ DECL_IN_SYSTEM_HEADER (type_decl) ? "sys" : "usr",
+ matches ? "bas" : "hdr",
+ generic ? "gen" : "ord",
+ usage == DINFO_USAGE_DFN ? ";" :
+ usage == DINFO_USAGE_DIR_USE ? "." : "*",
+ result,
+ (void*) type_decl, name);
+ return result;
+}
+#define DUMP_GSTRUCT(type, usage, criterion, generic, matches, result) \
+ dump_struct_debug (type, usage, criterion, generic, matches, result)
+
+#else
+
+#define DUMP_GSTRUCT(type, usage, criterion, generic, matches, result) \
+ (result)
+
+#endif
+
+
+bool
+should_emit_struct_debug (tree type, enum debug_info_usage usage)
+{
+ enum debug_struct_file criterion;
+ tree type_decl;
+ bool generic = lang_hooks.types.generic_p (type);
+
+ if (generic)
+ criterion = debug_struct_generic[usage];
+ else
+ criterion = debug_struct_ordinary[usage];
+
+ if (criterion == DINFO_STRUCT_FILE_NONE)
+ return DUMP_GSTRUCT (type, usage, criterion, generic, false, false);
+ if (criterion == DINFO_STRUCT_FILE_ANY)
+ return DUMP_GSTRUCT (type, usage, criterion, generic, false, true);
+
+ type_decl = TYPE_STUB_DECL (type);
+
+ if (criterion == DINFO_STRUCT_FILE_SYS && DECL_IN_SYSTEM_HEADER (type_decl))
+ return DUMP_GSTRUCT (type, usage, criterion, generic, false, true);
+
+ if (matches_main_base (DECL_SOURCE_FILE (type_decl)))
+ return DUMP_GSTRUCT (type, usage, criterion, generic, true, true);
+ return DUMP_GSTRUCT (type, usage, criterion, generic, false, false);
+}
+
/* Nonzero means use GNU-only extensions in the generated symbolic
debugging information. Currently, this only has an effect when
write_symbols is set to DBX_DEBUG, XCOFF_DEBUG, or DWARF_DEBUG. */
@@ -368,7 +618,11 @@ handle_options (unsigned int argc, const char **argv, unsigned int lang_mask)
if (opt[0] != '-' || opt[1] == '\0')
{
if (main_input_filename == NULL)
+ {
main_input_filename = opt;
+ main_input_baselength
+ = base_of_path (main_input_filename, &main_input_basename);
+ }
add_input_filename (opt);
n = 1;
continue;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index ea93fccaaee..652e4cc0c94 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,29 @@
+2007-04-16 Lawrence Crowl <crowl@google.com>
+
+ * g++.dg/other/fesd-any.C: Test -femit-struct-debug-detailed=any.
+ * g++.dg/other/fesd-any.h: Test -femit-struct-debug-detailed=any.
+ * g++.dg/other/fesd-baseonly.C: Test -femit-struct-debug-baseonly.
+ * g++.dg/other/fesd-baseonly.h: Test -femit-struct-debug-baseonly.
+ * g++.dg/other/fesd-none.C: Test -femit-struct-debug-detailed=none.
+ * g++.dg/other/fesd-none.h: Test -femit-struct-debug-detailed=none.
+ * g++.dg/other/fesd-reduced.C: Test -femit-struct-debug-reduced.
+ * g++.dg/other/fesd-reduced.h: Test -femit-struct-debug-reduced.
+ * g++.dg/other/fesd-sys.C: Test -femit-struct-debug-detailed=sys.
+ * g++.dg/other/fesd-sys.h: Test -femit-struct-debug-detailed=sys.
+ * g++.dg/other/fesd.h: Common to -femit-struct-debug-... tests.
+
+ * gcc.dg/fesd-any.c: Test -femit-struct-debug-detailed=any.
+ * gcc.dg/fesd-any.h: Test -femit-struct-debug-detailed=any.
+ * gcc.dg/fesd-baseonly.c: Test -femit-struct-debug-baseonly.
+ * gcc.dg/fesd-baseonly.h: Test -femit-struct-debug-baseonly.
+ * gcc.dg/fesd-none.c: Test -femit-struct-debug-detailed=none.
+ * gcc.dg/fesd-none.h: Test -femit-struct-debug-detailed=none.
+ * gcc.dg/fesd-reduced.c: Test -femit-struct-debug-reduced.
+ * gcc.dg/fesd-reduced.h: Test -femit-struct-debug-reduced.
+ * gcc.dg/fesd-sys.c: Test -femit-struct-debug-detailed=sys.
+ * gcc.dg/fesd-sys.h: Test -femit-struct-debug-detailed=sys.
+ * gcc.dg/fesd.h: Common to -femit-struct-debug-... tests.
+
2007-04-16 Ian Lance Taylor <iant@google.com>
PR tree-optimization/31522
diff --git a/gcc/testsuite/g++.dg/other/fesd-any.C b/gcc/testsuite/g++.dg/other/fesd-any.C
new file mode 100644
index 00000000000..a4a0b50ee50
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/fesd-any.C
@@ -0,0 +1,126 @@
+// { dg-do compile }
+// { dg-options "-gdwarf-2 -dA -femit-struct-debug-detailed=any" }
+// { dg-final { scan-assembler "timespec.*DW_AT_name" } }
+// { dg-final { scan-assembler "tv_sec.*DW_AT_name" } }
+// { dg-final { scan-assembler "tv_nsec.*DW_AT_name" } }
+// { dg-final { scan-assembler "itimerspec.*DW_AT_name" } }
+// { dg-final { scan-assembler "it_interval.*DW_AT_name" } }
+// { dg-final { scan-assembler "it_value.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_ordy_defn_ref_head.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_head_ordy_defn_ref_head.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_ordy_defn_ptr_head.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_head_ordy_defn_ptr_head.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_ordy_defn_fld_head.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_head_ordy_defn_fld_head.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_ordy_defn_var_head.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_head_ordy_defn_var_head_inc.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_head_ordy_defn_var_head_ref.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_head_ordy_defn_var_head_ptr.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_head_ordy_defn_var_head_fld.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_ordy_decl_ref_head.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_ordy_defn_ref_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_head_ordy_defn_ref_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_ordy_defn_ptr_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_head_ordy_defn_ptr_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_ordy_defn_fld_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_head_ordy_defn_fld_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_ordy_defn_var_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_head_ordy_defn_var_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_tmpl_defn_fld_head<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_head_tmpl_defn_fld_head.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_tmpl_defn_var_head<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_head_tmpl_defn_var_head_inc.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_head_tmpl_defn_var_head_ref.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_head_tmpl_defn_var_head_ptr.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_head_tmpl_defn_var_head_fld.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_tmpl_decl_ref_head<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_tmpl_defn_ref_head<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_tmpl_defn_ptr_head<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_head_tmpl_defn_ptr_head.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_ordy_defn_ref_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_base_ordy_defn_ref_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_ordy_defn_ptr_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_base_ordy_defn_ptr_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_ordy_defn_fld_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_base_ordy_defn_fld_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_ordy_defn_var_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "field1_base_ordy_defn_var_base_inc.*DW_AT_name" } }
+// { dg-final { scan-assembler "field1_base_ordy_defn_var_base_ref.*DW_AT_name" } }
+// { dg-final { scan-assembler "field1_base_ordy_defn_var_base_ptr.*DW_AT_name" } }
+// { dg-final { scan-assembler "field1_base_ordy_defn_var_base_fld.*DW_AT_name" } }
+// { dg-final { scan-assembler "field2_base_ordy_defn_var_base_inc.*DW_AT_name" } }
+// { dg-final { scan-assembler "field2_base_ordy_defn_var_base_ref.*DW_AT_name" } }
+// { dg-final { scan-assembler "field2_base_ordy_defn_var_base_ptr.*DW_AT_name" } }
+// { dg-final { scan-assembler "field2_base_ordy_defn_var_base_fld.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_ordy_decl_ref_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_ordy_decl_ref_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_tmpl_defn_var_base<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_head_tmpl_defn_var_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_tmpl_defn_fld_base<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_head_tmpl_defn_fld_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_tmpl_defn_fld_base<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_base_tmpl_defn_fld_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_tmpl_defn_var_base<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler "field1_base_tmpl_defn_var_base_inc.*DW_AT_name" } }
+// { dg-final { scan-assembler "field1_base_tmpl_defn_var_base_ref.*DW_AT_name" } }
+// { dg-final { scan-assembler "field1_base_tmpl_defn_var_base_ptr.*DW_AT_name" } }
+// { dg-final { scan-assembler "field1_base_tmpl_defn_var_base_fld.*DW_AT_name" } }
+// { dg-final { scan-assembler "field2_base_tmpl_defn_var_base_inc.*DW_AT_name" } }
+// { dg-final { scan-assembler "field2_base_tmpl_defn_var_base_ref.*DW_AT_name" } }
+// { dg-final { scan-assembler "field2_base_tmpl_defn_var_base_ptr.*DW_AT_name" } }
+// { dg-final { scan-assembler "field2_base_tmpl_defn_var_base_fld.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_tmpl_decl_ref_base<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_tmpl_defn_ref_base<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_tmpl_defn_ptr_base<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_head_tmpl_defn_ptr_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_tmpl_decl_ref_base<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_tmpl_defn_ref_base<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_tmpl_defn_ptr_base<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_base_tmpl_defn_ptr_base.*DW_AT_name" } }
+# 1 "fesd-any.C"
+# 1 "<built-in>"
+# 1 "<command-line>"
+# 1 "fesd-any.C"
+
+//#include "time.h"
+# 1 "time.h" 1 3 4
+struct timespec
+ {
+ long int tv_sec;
+ long int tv_nsec;
+ };
+
+struct itimerspec
+ {
+ struct timespec it_interval;
+ struct timespec it_value;
+ };
+
+# 6 "fesd-any.C" 2
+
+struct timespec base_var8;
+struct itimerspec *base_var9;
+
+#include "fesd-any.h"
+
+struct gstruct_head_ordy_defn_var_base base_var1;
+struct gstruct_base_ordy_defn_var_base base_var2;
+
+struct gstruct_head_tmpl_defn_var_base< int > base_var5;
+struct gstruct_base_tmpl_defn_var_base< int > base_var6;
+
+int base_function() {
+ return 0
++ base_var1.field_head_ordy_defn_var_base
++ base_var2.field1_base_ordy_defn_var_base_ptr->field_head_ordy_defn_ptr_base
++ base_var2.field1_base_ordy_defn_var_base_fld.field_head_ordy_defn_fld_base
++ base_var2.field2_base_ordy_defn_var_base_ptr->field_base_ordy_defn_ptr_base
++ base_var2.field2_base_ordy_defn_var_base_fld.field_base_ordy_defn_fld_base
++ base_var5.field_head_tmpl_defn_var_base
++ base_var6.field1_base_tmpl_defn_var_base_ptr->field_head_tmpl_defn_ptr_base
++ base_var6.field1_base_tmpl_defn_var_base_fld.field_head_tmpl_defn_fld_base
++ base_var6.field2_base_tmpl_defn_var_base_ptr->field_base_tmpl_defn_ptr_base
++ base_var6.field2_base_tmpl_defn_var_base_fld.field_base_tmpl_defn_fld_base
+;
+}
+
diff --git a/gcc/testsuite/g++.dg/other/fesd-any.h b/gcc/testsuite/g++.dg/other/fesd-any.h
new file mode 100644
index 00000000000..762f5878f93
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/fesd-any.h
@@ -0,0 +1,42 @@
+#include "fesd.h"
+
+struct gstruct_base_ordy_decl_not;
+struct gstruct_base_ordy_defn_not { int field_base_ordy_defn_not; };
+
+struct gstruct_base_ordy_decl_ref_base;
+struct gstruct_base_ordy_defn_ref_base { int field_base_ordy_defn_ref_base; };
+struct gstruct_base_ordy_defn_ptr_base { int field_base_ordy_defn_ptr_base; };
+struct gstruct_base_ordy_defn_fld_base { int field_base_ordy_defn_fld_base; };
+struct gstruct_base_ordy_defn_var_base {
+ gstruct_head_ordy_decl_ref_base *field1_base_ordy_defn_var_base_inc;
+ gstruct_head_ordy_defn_ref_base *field1_base_ordy_defn_var_base_ref;
+ gstruct_head_ordy_defn_ptr_base *field1_base_ordy_defn_var_base_ptr;
+ gstruct_head_ordy_defn_fld_base field1_base_ordy_defn_var_base_fld;
+ gstruct_base_ordy_decl_ref_base *field2_base_ordy_defn_var_base_inc;
+ gstruct_base_ordy_defn_ref_base *field2_base_ordy_defn_var_base_ref;
+ gstruct_base_ordy_defn_ptr_base *field2_base_ordy_defn_var_base_ptr;
+ gstruct_base_ordy_defn_fld_base field2_base_ordy_defn_var_base_fld;
+};
+
+template< typename T > struct gstruct_base_tmpl_decl_not;
+template< typename T > struct gstruct_base_tmpl_defn_not
+{ int field_base_tmpl_defn_not; };
+
+template< typename T > struct gstruct_base_tmpl_decl_ref_base;
+template< typename T > struct gstruct_base_tmpl_defn_ref_base
+{ int field_base_tmpl_defn_ref_base; };
+template< typename T > struct gstruct_base_tmpl_defn_ptr_base
+{ int field_base_tmpl_defn_ptr_base; };
+template< typename T > struct gstruct_base_tmpl_defn_fld_base
+{ int field_base_tmpl_defn_fld_base; };
+template< typename T > struct gstruct_base_tmpl_defn_var_base {
+ gstruct_head_tmpl_decl_ref_base< T > *field1_base_tmpl_defn_var_base_inc;
+ gstruct_head_tmpl_defn_ref_base< T > *field1_base_tmpl_defn_var_base_ref;
+ gstruct_head_tmpl_defn_ptr_base< T > *field1_base_tmpl_defn_var_base_ptr;
+ gstruct_head_tmpl_defn_fld_base< T > field1_base_tmpl_defn_var_base_fld;
+ gstruct_base_tmpl_decl_ref_base< T > *field2_base_tmpl_defn_var_base_inc;
+ gstruct_base_tmpl_defn_ref_base< T > *field2_base_tmpl_defn_var_base_ref;
+ gstruct_base_tmpl_defn_ptr_base< T > *field2_base_tmpl_defn_var_base_ptr;
+ gstruct_base_tmpl_defn_fld_base< T > field2_base_tmpl_defn_var_base_fld;
+};
+
diff --git a/gcc/testsuite/g++.dg/other/fesd-baseonly.C b/gcc/testsuite/g++.dg/other/fesd-baseonly.C
new file mode 100644
index 00000000000..4f580ebd361
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/fesd-baseonly.C
@@ -0,0 +1,126 @@
+// { dg-do compile }
+// { dg-options "-gdwarf-2 -dA -femit-struct-debug-baseonly" }
+// { dg-final { scan-assembler "timespec.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "tv_sec.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "tv_nsec.*DW_AT_name" } }
+// { dg-final { scan-assembler "itimerspec.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "it_interval.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "it_value.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_head_ordy_defn_ref_head.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_ref_head.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_head_ordy_defn_ptr_head.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_ptr_head.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_head_ordy_defn_fld_head.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_fld_head.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_ordy_defn_var_head.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_var_head_inc.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_var_head_ref.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_var_head_ptr.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_var_head_fld.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_head_ordy_decl_ref_head.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_ordy_defn_ref_base.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_ref_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_ordy_defn_ptr_base.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_ptr_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_ordy_defn_fld_base.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_fld_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_ordy_defn_var_base.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_var_base.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_head_tmpl_defn_fld_head<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_tmpl_defn_fld_head.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_tmpl_defn_var_head<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_tmpl_defn_var_head_inc.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_tmpl_defn_var_head_ref.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_tmpl_defn_var_head_ptr.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_tmpl_defn_var_head_fld.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_head_tmpl_decl_ref_head<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_head_tmpl_defn_ref_head<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_head_tmpl_defn_ptr_head<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_tmpl_defn_ptr_head.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_ordy_defn_ref_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_base_ordy_defn_ref_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_ordy_defn_ptr_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_base_ordy_defn_ptr_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_ordy_defn_fld_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_base_ordy_defn_fld_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_ordy_defn_var_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "field1_base_ordy_defn_var_base_inc.*DW_AT_name" } }
+// { dg-final { scan-assembler "field1_base_ordy_defn_var_base_ref.*DW_AT_name" } }
+// { dg-final { scan-assembler "field1_base_ordy_defn_var_base_ptr.*DW_AT_name" } }
+// { dg-final { scan-assembler "field1_base_ordy_defn_var_base_fld.*DW_AT_name" } }
+// { dg-final { scan-assembler "field2_base_ordy_defn_var_base_inc.*DW_AT_name" } }
+// { dg-final { scan-assembler "field2_base_ordy_defn_var_base_ref.*DW_AT_name" } }
+// { dg-final { scan-assembler "field2_base_ordy_defn_var_base_ptr.*DW_AT_name" } }
+// { dg-final { scan-assembler "field2_base_ordy_defn_var_base_fld.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_ordy_decl_ref_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_ordy_decl_ref_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_tmpl_defn_var_base<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_tmpl_defn_var_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_tmpl_defn_fld_base<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_tmpl_defn_fld_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_tmpl_defn_fld_base<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_base_tmpl_defn_fld_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_tmpl_defn_var_base<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler "field1_base_tmpl_defn_var_base_inc.*DW_AT_name" } }
+// { dg-final { scan-assembler "field1_base_tmpl_defn_var_base_ref.*DW_AT_name" } }
+// { dg-final { scan-assembler "field1_base_tmpl_defn_var_base_ptr.*DW_AT_name" } }
+// { dg-final { scan-assembler "field1_base_tmpl_defn_var_base_fld.*DW_AT_name" } }
+// { dg-final { scan-assembler "field2_base_tmpl_defn_var_base_inc.*DW_AT_name" } }
+// { dg-final { scan-assembler "field2_base_tmpl_defn_var_base_ref.*DW_AT_name" } }
+// { dg-final { scan-assembler "field2_base_tmpl_defn_var_base_ptr.*DW_AT_name" } }
+// { dg-final { scan-assembler "field2_base_tmpl_defn_var_base_fld.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_tmpl_decl_ref_base<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_tmpl_defn_ref_base<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_tmpl_defn_ptr_base<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_tmpl_defn_ptr_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_tmpl_decl_ref_base<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_tmpl_defn_ref_base<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_tmpl_defn_ptr_base<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_base_tmpl_defn_ptr_base.*DW_AT_name" } }
+# 1 "fesd-baseonly.C"
+# 1 "<built-in>"
+# 1 "<command-line>"
+# 1 "fesd-baseonly.C"
+
+//#include "time.h"
+# 1 "time.h" 1 3 4
+struct timespec
+ {
+ long int tv_sec;
+ long int tv_nsec;
+ };
+
+struct itimerspec
+ {
+ struct timespec it_interval;
+ struct timespec it_value;
+ };
+
+# 6 "fesd-baseonly.C" 2
+
+struct timespec base_var8;
+struct itimerspec *base_var9;
+
+#include "fesd-baseonly.h"
+
+struct gstruct_head_ordy_defn_var_base base_var1;
+struct gstruct_base_ordy_defn_var_base base_var2;
+
+struct gstruct_head_tmpl_defn_var_base< int > base_var5;
+struct gstruct_base_tmpl_defn_var_base< int > base_var6;
+
+int base_function() {
+ return 0
++ base_var1.field_head_ordy_defn_var_base
++ base_var2.field1_base_ordy_defn_var_base_ptr->field_head_ordy_defn_ptr_base
++ base_var2.field1_base_ordy_defn_var_base_fld.field_head_ordy_defn_fld_base
++ base_var2.field2_base_ordy_defn_var_base_ptr->field_base_ordy_defn_ptr_base
++ base_var2.field2_base_ordy_defn_var_base_fld.field_base_ordy_defn_fld_base
++ base_var5.field_head_tmpl_defn_var_base
++ base_var6.field1_base_tmpl_defn_var_base_ptr->field_head_tmpl_defn_ptr_base
++ base_var6.field1_base_tmpl_defn_var_base_fld.field_head_tmpl_defn_fld_base
++ base_var6.field2_base_tmpl_defn_var_base_ptr->field_base_tmpl_defn_ptr_base
++ base_var6.field2_base_tmpl_defn_var_base_fld.field_base_tmpl_defn_fld_base
+;
+}
+
diff --git a/gcc/testsuite/g++.dg/other/fesd-baseonly.h b/gcc/testsuite/g++.dg/other/fesd-baseonly.h
new file mode 100644
index 00000000000..762f5878f93
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/fesd-baseonly.h
@@ -0,0 +1,42 @@
+#include "fesd.h"
+
+struct gstruct_base_ordy_decl_not;
+struct gstruct_base_ordy_defn_not { int field_base_ordy_defn_not; };
+
+struct gstruct_base_ordy_decl_ref_base;
+struct gstruct_base_ordy_defn_ref_base { int field_base_ordy_defn_ref_base; };
+struct gstruct_base_ordy_defn_ptr_base { int field_base_ordy_defn_ptr_base; };
+struct gstruct_base_ordy_defn_fld_base { int field_base_ordy_defn_fld_base; };
+struct gstruct_base_ordy_defn_var_base {
+ gstruct_head_ordy_decl_ref_base *field1_base_ordy_defn_var_base_inc;
+ gstruct_head_ordy_defn_ref_base *field1_base_ordy_defn_var_base_ref;
+ gstruct_head_ordy_defn_ptr_base *field1_base_ordy_defn_var_base_ptr;
+ gstruct_head_ordy_defn_fld_base field1_base_ordy_defn_var_base_fld;
+ gstruct_base_ordy_decl_ref_base *field2_base_ordy_defn_var_base_inc;
+ gstruct_base_ordy_defn_ref_base *field2_base_ordy_defn_var_base_ref;
+ gstruct_base_ordy_defn_ptr_base *field2_base_ordy_defn_var_base_ptr;
+ gstruct_base_ordy_defn_fld_base field2_base_ordy_defn_var_base_fld;
+};
+
+template< typename T > struct gstruct_base_tmpl_decl_not;
+template< typename T > struct gstruct_base_tmpl_defn_not
+{ int field_base_tmpl_defn_not; };
+
+template< typename T > struct gstruct_base_tmpl_decl_ref_base;
+template< typename T > struct gstruct_base_tmpl_defn_ref_base
+{ int field_base_tmpl_defn_ref_base; };
+template< typename T > struct gstruct_base_tmpl_defn_ptr_base
+{ int field_base_tmpl_defn_ptr_base; };
+template< typename T > struct gstruct_base_tmpl_defn_fld_base
+{ int field_base_tmpl_defn_fld_base; };
+template< typename T > struct gstruct_base_tmpl_defn_var_base {
+ gstruct_head_tmpl_decl_ref_base< T > *field1_base_tmpl_defn_var_base_inc;
+ gstruct_head_tmpl_defn_ref_base< T > *field1_base_tmpl_defn_var_base_ref;
+ gstruct_head_tmpl_defn_ptr_base< T > *field1_base_tmpl_defn_var_base_ptr;
+ gstruct_head_tmpl_defn_fld_base< T > field1_base_tmpl_defn_var_base_fld;
+ gstruct_base_tmpl_decl_ref_base< T > *field2_base_tmpl_defn_var_base_inc;
+ gstruct_base_tmpl_defn_ref_base< T > *field2_base_tmpl_defn_var_base_ref;
+ gstruct_base_tmpl_defn_ptr_base< T > *field2_base_tmpl_defn_var_base_ptr;
+ gstruct_base_tmpl_defn_fld_base< T > field2_base_tmpl_defn_var_base_fld;
+};
+
diff --git a/gcc/testsuite/g++.dg/other/fesd-none.C b/gcc/testsuite/g++.dg/other/fesd-none.C
new file mode 100644
index 00000000000..0af0a83d85f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/fesd-none.C
@@ -0,0 +1,126 @@
+// { dg-do compile }
+// { dg-options "-gdwarf-2 -dA -femit-struct-debug-detailed=none" }
+// { dg-final { scan-assembler "timespec.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "tv_sec.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "tv_nsec.*DW_AT_name" } }
+// { dg-final { scan-assembler "itimerspec.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "it_interval.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "it_value.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_head_ordy_defn_ref_head.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_ref_head.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_head_ordy_defn_ptr_head.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_ptr_head.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_head_ordy_defn_fld_head.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_fld_head.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_ordy_defn_var_head.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_var_head_inc.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_var_head_ref.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_var_head_ptr.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_var_head_fld.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_head_ordy_decl_ref_head.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_head_ordy_defn_ref_base.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_ref_base.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_head_ordy_defn_ptr_base.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_ptr_base.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_head_ordy_defn_fld_base.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_fld_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_ordy_defn_var_base.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_var_base.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_head_tmpl_defn_fld_head<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_tmpl_defn_fld_head.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_tmpl_defn_var_head<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_tmpl_defn_var_head_inc.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_tmpl_defn_var_head_ref.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_tmpl_defn_var_head_ptr.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_tmpl_defn_var_head_fld.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_head_tmpl_decl_ref_head<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_head_tmpl_defn_ref_head<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_head_tmpl_defn_ptr_head<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_tmpl_defn_ptr_head.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_base_ordy_defn_ref_base.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_base_ordy_defn_ref_base.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_base_ordy_defn_ptr_base.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_base_ordy_defn_ptr_base.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_base_ordy_defn_fld_base.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_base_ordy_defn_fld_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_ordy_defn_var_base.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field1_base_ordy_defn_var_base_inc.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field1_base_ordy_defn_var_base_ref.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field1_base_ordy_defn_var_base_ptr.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field1_base_ordy_defn_var_base_fld.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field2_base_ordy_defn_var_base_inc.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field2_base_ordy_defn_var_base_ref.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field2_base_ordy_defn_var_base_ptr.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field2_base_ordy_defn_var_base_fld.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_head_ordy_decl_ref_base.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_base_ordy_decl_ref_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_tmpl_defn_var_base<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_tmpl_defn_var_base.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_head_tmpl_defn_fld_base<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_tmpl_defn_fld_base.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_base_tmpl_defn_fld_base<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_base_tmpl_defn_fld_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_tmpl_defn_var_base<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field1_base_tmpl_defn_var_base_inc.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field1_base_tmpl_defn_var_base_ref.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field1_base_tmpl_defn_var_base_ptr.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field1_base_tmpl_defn_var_base_fld.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field2_base_tmpl_defn_var_base_inc.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field2_base_tmpl_defn_var_base_ref.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field2_base_tmpl_defn_var_base_ptr.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field2_base_tmpl_defn_var_base_fld.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_head_tmpl_decl_ref_base<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_head_tmpl_defn_ref_base<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_head_tmpl_defn_ptr_base<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_tmpl_defn_ptr_base.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_base_tmpl_decl_ref_base<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_base_tmpl_defn_ref_base<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_base_tmpl_defn_ptr_base<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_base_tmpl_defn_ptr_base.*DW_AT_name" } }
+# 1 "fesd-none.C"
+# 1 "<built-in>"
+# 1 "<command-line>"
+# 1 "fesd-none.C"
+
+//#include "time.h"
+# 1 "time.h" 1 3 4
+struct timespec
+ {
+ long int tv_sec;
+ long int tv_nsec;
+ };
+
+struct itimerspec
+ {
+ struct timespec it_interval;
+ struct timespec it_value;
+ };
+
+# 6 "fesd-none.C" 2
+
+struct timespec base_var8;
+struct itimerspec *base_var9;
+
+#include "fesd-none.h"
+
+struct gstruct_head_ordy_defn_var_base base_var1;
+struct gstruct_base_ordy_defn_var_base base_var2;
+
+struct gstruct_head_tmpl_defn_var_base< int > base_var5;
+struct gstruct_base_tmpl_defn_var_base< int > base_var6;
+
+int base_function() {
+ return 0
++ base_var1.field_head_ordy_defn_var_base
++ base_var2.field1_base_ordy_defn_var_base_ptr->field_head_ordy_defn_ptr_base
++ base_var2.field1_base_ordy_defn_var_base_fld.field_head_ordy_defn_fld_base
++ base_var2.field2_base_ordy_defn_var_base_ptr->field_base_ordy_defn_ptr_base
++ base_var2.field2_base_ordy_defn_var_base_fld.field_base_ordy_defn_fld_base
++ base_var5.field_head_tmpl_defn_var_base
++ base_var6.field1_base_tmpl_defn_var_base_ptr->field_head_tmpl_defn_ptr_base
++ base_var6.field1_base_tmpl_defn_var_base_fld.field_head_tmpl_defn_fld_base
++ base_var6.field2_base_tmpl_defn_var_base_ptr->field_base_tmpl_defn_ptr_base
++ base_var6.field2_base_tmpl_defn_var_base_fld.field_base_tmpl_defn_fld_base
+;
+}
+
diff --git a/gcc/testsuite/g++.dg/other/fesd-none.h b/gcc/testsuite/g++.dg/other/fesd-none.h
new file mode 100644
index 00000000000..762f5878f93
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/fesd-none.h
@@ -0,0 +1,42 @@
+#include "fesd.h"
+
+struct gstruct_base_ordy_decl_not;
+struct gstruct_base_ordy_defn_not { int field_base_ordy_defn_not; };
+
+struct gstruct_base_ordy_decl_ref_base;
+struct gstruct_base_ordy_defn_ref_base { int field_base_ordy_defn_ref_base; };
+struct gstruct_base_ordy_defn_ptr_base { int field_base_ordy_defn_ptr_base; };
+struct gstruct_base_ordy_defn_fld_base { int field_base_ordy_defn_fld_base; };
+struct gstruct_base_ordy_defn_var_base {
+ gstruct_head_ordy_decl_ref_base *field1_base_ordy_defn_var_base_inc;
+ gstruct_head_ordy_defn_ref_base *field1_base_ordy_defn_var_base_ref;
+ gstruct_head_ordy_defn_ptr_base *field1_base_ordy_defn_var_base_ptr;
+ gstruct_head_ordy_defn_fld_base field1_base_ordy_defn_var_base_fld;
+ gstruct_base_ordy_decl_ref_base *field2_base_ordy_defn_var_base_inc;
+ gstruct_base_ordy_defn_ref_base *field2_base_ordy_defn_var_base_ref;
+ gstruct_base_ordy_defn_ptr_base *field2_base_ordy_defn_var_base_ptr;
+ gstruct_base_ordy_defn_fld_base field2_base_ordy_defn_var_base_fld;
+};
+
+template< typename T > struct gstruct_base_tmpl_decl_not;
+template< typename T > struct gstruct_base_tmpl_defn_not
+{ int field_base_tmpl_defn_not; };
+
+template< typename T > struct gstruct_base_tmpl_decl_ref_base;
+template< typename T > struct gstruct_base_tmpl_defn_ref_base
+{ int field_base_tmpl_defn_ref_base; };
+template< typename T > struct gstruct_base_tmpl_defn_ptr_base
+{ int field_base_tmpl_defn_ptr_base; };
+template< typename T > struct gstruct_base_tmpl_defn_fld_base
+{ int field_base_tmpl_defn_fld_base; };
+template< typename T > struct gstruct_base_tmpl_defn_var_base {
+ gstruct_head_tmpl_decl_ref_base< T > *field1_base_tmpl_defn_var_base_inc;
+ gstruct_head_tmpl_defn_ref_base< T > *field1_base_tmpl_defn_var_base_ref;
+ gstruct_head_tmpl_defn_ptr_base< T > *field1_base_tmpl_defn_var_base_ptr;
+ gstruct_head_tmpl_defn_fld_base< T > field1_base_tmpl_defn_var_base_fld;
+ gstruct_base_tmpl_decl_ref_base< T > *field2_base_tmpl_defn_var_base_inc;
+ gstruct_base_tmpl_defn_ref_base< T > *field2_base_tmpl_defn_var_base_ref;
+ gstruct_base_tmpl_defn_ptr_base< T > *field2_base_tmpl_defn_var_base_ptr;
+ gstruct_base_tmpl_defn_fld_base< T > field2_base_tmpl_defn_var_base_fld;
+};
+
diff --git a/gcc/testsuite/g++.dg/other/fesd-reduced.C b/gcc/testsuite/g++.dg/other/fesd-reduced.C
new file mode 100644
index 00000000000..a93b90f05ad
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/fesd-reduced.C
@@ -0,0 +1,126 @@
+// { dg-do compile }
+// { dg-options "-gdwarf-2 -dA -femit-struct-debug-reduced" }
+// { dg-final { scan-assembler "timespec.*DW_AT_name" } }
+// { dg-final { scan-assembler "tv_sec.*DW_AT_name" } }
+// { dg-final { scan-assembler "tv_nsec.*DW_AT_name" } }
+// { dg-final { scan-assembler "itimerspec.*DW_AT_name" } }
+// { dg-final { scan-assembler "it_interval.*DW_AT_name" } }
+// { dg-final { scan-assembler "it_value.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_head_ordy_defn_ref_head.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_ref_head.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_head_ordy_defn_ptr_head.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_ptr_head.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_head_ordy_defn_fld_head.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_fld_head.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_ordy_defn_var_head.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_var_head_inc.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_var_head_ref.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_var_head_ptr.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_var_head_fld.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_head_ordy_decl_ref_head.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_ordy_defn_ref_base.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_ref_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_ordy_defn_ptr_base.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_ptr_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_ordy_defn_fld_base.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_fld_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_ordy_defn_var_base.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_var_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_tmpl_defn_fld_head<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_head_tmpl_defn_fld_head.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_tmpl_defn_var_head<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_head_tmpl_defn_var_head_inc.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_head_tmpl_defn_var_head_ref.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_head_tmpl_defn_var_head_ptr.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_head_tmpl_defn_var_head_fld.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_tmpl_decl_ref_head<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_tmpl_defn_ref_head<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_tmpl_defn_ptr_head<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_head_tmpl_defn_ptr_head.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_ordy_defn_ref_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_base_ordy_defn_ref_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_ordy_defn_ptr_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_base_ordy_defn_ptr_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_ordy_defn_fld_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_base_ordy_defn_fld_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_ordy_defn_var_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "field1_base_ordy_defn_var_base_inc.*DW_AT_name" } }
+// { dg-final { scan-assembler "field1_base_ordy_defn_var_base_ref.*DW_AT_name" } }
+// { dg-final { scan-assembler "field1_base_ordy_defn_var_base_ptr.*DW_AT_name" } }
+// { dg-final { scan-assembler "field1_base_ordy_defn_var_base_fld.*DW_AT_name" } }
+// { dg-final { scan-assembler "field2_base_ordy_defn_var_base_inc.*DW_AT_name" } }
+// { dg-final { scan-assembler "field2_base_ordy_defn_var_base_ref.*DW_AT_name" } }
+// { dg-final { scan-assembler "field2_base_ordy_defn_var_base_ptr.*DW_AT_name" } }
+// { dg-final { scan-assembler "field2_base_ordy_defn_var_base_fld.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_ordy_decl_ref_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_ordy_decl_ref_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_tmpl_defn_var_base<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_head_tmpl_defn_var_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_tmpl_defn_fld_base<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_head_tmpl_defn_fld_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_tmpl_defn_fld_base<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_base_tmpl_defn_fld_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_tmpl_defn_var_base<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler "field1_base_tmpl_defn_var_base_inc.*DW_AT_name" } }
+// { dg-final { scan-assembler "field1_base_tmpl_defn_var_base_ref.*DW_AT_name" } }
+// { dg-final { scan-assembler "field1_base_tmpl_defn_var_base_ptr.*DW_AT_name" } }
+// { dg-final { scan-assembler "field1_base_tmpl_defn_var_base_fld.*DW_AT_name" } }
+// { dg-final { scan-assembler "field2_base_tmpl_defn_var_base_inc.*DW_AT_name" } }
+// { dg-final { scan-assembler "field2_base_tmpl_defn_var_base_ref.*DW_AT_name" } }
+// { dg-final { scan-assembler "field2_base_tmpl_defn_var_base_ptr.*DW_AT_name" } }
+// { dg-final { scan-assembler "field2_base_tmpl_defn_var_base_fld.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_tmpl_decl_ref_base<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_tmpl_defn_ref_base<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_tmpl_defn_ptr_base<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_head_tmpl_defn_ptr_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_tmpl_decl_ref_base<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_tmpl_defn_ref_base<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_tmpl_defn_ptr_base<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_base_tmpl_defn_ptr_base.*DW_AT_name" } }
+# 1 "fesd-reduced.C"
+# 1 "<built-in>"
+# 1 "<command-line>"
+# 1 "fesd-reduced.C"
+
+//#include "time.h"
+# 1 "time.h" 1 3 4
+struct timespec
+ {
+ long int tv_sec;
+ long int tv_nsec;
+ };
+
+struct itimerspec
+ {
+ struct timespec it_interval;
+ struct timespec it_value;
+ };
+
+# 6 "fesd-reduced.C" 2
+
+struct timespec base_var8;
+struct itimerspec *base_var9;
+
+#include "fesd-reduced.h"
+
+struct gstruct_head_ordy_defn_var_base base_var1;
+struct gstruct_base_ordy_defn_var_base base_var2;
+
+struct gstruct_head_tmpl_defn_var_base< int > base_var5;
+struct gstruct_base_tmpl_defn_var_base< int > base_var6;
+
+int base_function() {
+ return 0
++ base_var1.field_head_ordy_defn_var_base
++ base_var2.field1_base_ordy_defn_var_base_ptr->field_head_ordy_defn_ptr_base
++ base_var2.field1_base_ordy_defn_var_base_fld.field_head_ordy_defn_fld_base
++ base_var2.field2_base_ordy_defn_var_base_ptr->field_base_ordy_defn_ptr_base
++ base_var2.field2_base_ordy_defn_var_base_fld.field_base_ordy_defn_fld_base
++ base_var5.field_head_tmpl_defn_var_base
++ base_var6.field1_base_tmpl_defn_var_base_ptr->field_head_tmpl_defn_ptr_base
++ base_var6.field1_base_tmpl_defn_var_base_fld.field_head_tmpl_defn_fld_base
++ base_var6.field2_base_tmpl_defn_var_base_ptr->field_base_tmpl_defn_ptr_base
++ base_var6.field2_base_tmpl_defn_var_base_fld.field_base_tmpl_defn_fld_base
+;
+}
+
diff --git a/gcc/testsuite/g++.dg/other/fesd-reduced.h b/gcc/testsuite/g++.dg/other/fesd-reduced.h
new file mode 100644
index 00000000000..762f5878f93
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/fesd-reduced.h
@@ -0,0 +1,42 @@
+#include "fesd.h"
+
+struct gstruct_base_ordy_decl_not;
+struct gstruct_base_ordy_defn_not { int field_base_ordy_defn_not; };
+
+struct gstruct_base_ordy_decl_ref_base;
+struct gstruct_base_ordy_defn_ref_base { int field_base_ordy_defn_ref_base; };
+struct gstruct_base_ordy_defn_ptr_base { int field_base_ordy_defn_ptr_base; };
+struct gstruct_base_ordy_defn_fld_base { int field_base_ordy_defn_fld_base; };
+struct gstruct_base_ordy_defn_var_base {
+ gstruct_head_ordy_decl_ref_base *field1_base_ordy_defn_var_base_inc;
+ gstruct_head_ordy_defn_ref_base *field1_base_ordy_defn_var_base_ref;
+ gstruct_head_ordy_defn_ptr_base *field1_base_ordy_defn_var_base_ptr;
+ gstruct_head_ordy_defn_fld_base field1_base_ordy_defn_var_base_fld;
+ gstruct_base_ordy_decl_ref_base *field2_base_ordy_defn_var_base_inc;
+ gstruct_base_ordy_defn_ref_base *field2_base_ordy_defn_var_base_ref;
+ gstruct_base_ordy_defn_ptr_base *field2_base_ordy_defn_var_base_ptr;
+ gstruct_base_ordy_defn_fld_base field2_base_ordy_defn_var_base_fld;
+};
+
+template< typename T > struct gstruct_base_tmpl_decl_not;
+template< typename T > struct gstruct_base_tmpl_defn_not
+{ int field_base_tmpl_defn_not; };
+
+template< typename T > struct gstruct_base_tmpl_decl_ref_base;
+template< typename T > struct gstruct_base_tmpl_defn_ref_base
+{ int field_base_tmpl_defn_ref_base; };
+template< typename T > struct gstruct_base_tmpl_defn_ptr_base
+{ int field_base_tmpl_defn_ptr_base; };
+template< typename T > struct gstruct_base_tmpl_defn_fld_base
+{ int field_base_tmpl_defn_fld_base; };
+template< typename T > struct gstruct_base_tmpl_defn_var_base {
+ gstruct_head_tmpl_decl_ref_base< T > *field1_base_tmpl_defn_var_base_inc;
+ gstruct_head_tmpl_defn_ref_base< T > *field1_base_tmpl_defn_var_base_ref;
+ gstruct_head_tmpl_defn_ptr_base< T > *field1_base_tmpl_defn_var_base_ptr;
+ gstruct_head_tmpl_defn_fld_base< T > field1_base_tmpl_defn_var_base_fld;
+ gstruct_base_tmpl_decl_ref_base< T > *field2_base_tmpl_defn_var_base_inc;
+ gstruct_base_tmpl_defn_ref_base< T > *field2_base_tmpl_defn_var_base_ref;
+ gstruct_base_tmpl_defn_ptr_base< T > *field2_base_tmpl_defn_var_base_ptr;
+ gstruct_base_tmpl_defn_fld_base< T > field2_base_tmpl_defn_var_base_fld;
+};
+
diff --git a/gcc/testsuite/g++.dg/other/fesd-sys.C b/gcc/testsuite/g++.dg/other/fesd-sys.C
new file mode 100644
index 00000000000..95a9a31ff60
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/fesd-sys.C
@@ -0,0 +1,126 @@
+// { dg-do compile }
+// { dg-options "-gdwarf-2 -dA -femit-struct-debug-detailed=sys" }
+// { dg-final { scan-assembler "timespec.*DW_AT_name" } }
+// { dg-final { scan-assembler "tv_sec.*DW_AT_name" } }
+// { dg-final { scan-assembler "tv_nsec.*DW_AT_name" } }
+// { dg-final { scan-assembler "itimerspec.*DW_AT_name" } }
+// { dg-final { scan-assembler "it_interval.*DW_AT_name" } }
+// { dg-final { scan-assembler "it_value.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_head_ordy_defn_ref_head.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_ref_head.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_head_ordy_defn_ptr_head.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_ptr_head.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_head_ordy_defn_fld_head.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_fld_head.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_ordy_defn_var_head.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_var_head_inc.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_var_head_ref.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_var_head_ptr.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_var_head_fld.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_head_ordy_decl_ref_head.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_ordy_defn_ref_base.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_ref_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_ordy_defn_ptr_base.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_ptr_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_ordy_defn_fld_base.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_fld_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_ordy_defn_var_base.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_var_base.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_head_tmpl_defn_fld_head<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_tmpl_defn_fld_head.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_tmpl_defn_var_head<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_tmpl_defn_var_head_inc.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_tmpl_defn_var_head_ref.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_tmpl_defn_var_head_ptr.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_tmpl_defn_var_head_fld.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_head_tmpl_decl_ref_head<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_head_tmpl_defn_ref_head<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_head_tmpl_defn_ptr_head<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_tmpl_defn_ptr_head.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_ordy_defn_ref_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_base_ordy_defn_ref_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_ordy_defn_ptr_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_base_ordy_defn_ptr_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_ordy_defn_fld_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_base_ordy_defn_fld_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_ordy_defn_var_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "field1_base_ordy_defn_var_base_inc.*DW_AT_name" } }
+// { dg-final { scan-assembler "field1_base_ordy_defn_var_base_ref.*DW_AT_name" } }
+// { dg-final { scan-assembler "field1_base_ordy_defn_var_base_ptr.*DW_AT_name" } }
+// { dg-final { scan-assembler "field1_base_ordy_defn_var_base_fld.*DW_AT_name" } }
+// { dg-final { scan-assembler "field2_base_ordy_defn_var_base_inc.*DW_AT_name" } }
+// { dg-final { scan-assembler "field2_base_ordy_defn_var_base_ref.*DW_AT_name" } }
+// { dg-final { scan-assembler "field2_base_ordy_defn_var_base_ptr.*DW_AT_name" } }
+// { dg-final { scan-assembler "field2_base_ordy_defn_var_base_fld.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_ordy_decl_ref_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_ordy_decl_ref_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_tmpl_defn_var_base<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_tmpl_defn_var_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_tmpl_defn_fld_base<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_tmpl_defn_fld_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_tmpl_defn_fld_base<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_base_tmpl_defn_fld_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_tmpl_defn_var_base<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler "field1_base_tmpl_defn_var_base_inc.*DW_AT_name" } }
+// { dg-final { scan-assembler "field1_base_tmpl_defn_var_base_ref.*DW_AT_name" } }
+// { dg-final { scan-assembler "field1_base_tmpl_defn_var_base_ptr.*DW_AT_name" } }
+// { dg-final { scan-assembler "field1_base_tmpl_defn_var_base_fld.*DW_AT_name" } }
+// { dg-final { scan-assembler "field2_base_tmpl_defn_var_base_inc.*DW_AT_name" } }
+// { dg-final { scan-assembler "field2_base_tmpl_defn_var_base_ref.*DW_AT_name" } }
+// { dg-final { scan-assembler "field2_base_tmpl_defn_var_base_ptr.*DW_AT_name" } }
+// { dg-final { scan-assembler "field2_base_tmpl_defn_var_base_fld.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_tmpl_decl_ref_base<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_tmpl_defn_ref_base<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_tmpl_defn_ptr_base<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_tmpl_defn_ptr_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_tmpl_decl_ref_base<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_tmpl_defn_ref_base<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_tmpl_defn_ptr_base<int>.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_base_tmpl_defn_ptr_base.*DW_AT_name" } }
+# 1 "fesd-sys.C"
+# 1 "<built-in>"
+# 1 "<command-line>"
+# 1 "fesd-sys.C"
+
+//#include "time.h"
+# 1 "time.h" 1 3 4
+struct timespec
+ {
+ long int tv_sec;
+ long int tv_nsec;
+ };
+
+struct itimerspec
+ {
+ struct timespec it_interval;
+ struct timespec it_value;
+ };
+
+# 6 "fesd-sys.C" 2
+
+struct timespec base_var8;
+struct itimerspec *base_var9;
+
+#include "fesd-sys.h"
+
+struct gstruct_head_ordy_defn_var_base base_var1;
+struct gstruct_base_ordy_defn_var_base base_var2;
+
+struct gstruct_head_tmpl_defn_var_base< int > base_var5;
+struct gstruct_base_tmpl_defn_var_base< int > base_var6;
+
+int base_function() {
+ return 0
++ base_var1.field_head_ordy_defn_var_base
++ base_var2.field1_base_ordy_defn_var_base_ptr->field_head_ordy_defn_ptr_base
++ base_var2.field1_base_ordy_defn_var_base_fld.field_head_ordy_defn_fld_base
++ base_var2.field2_base_ordy_defn_var_base_ptr->field_base_ordy_defn_ptr_base
++ base_var2.field2_base_ordy_defn_var_base_fld.field_base_ordy_defn_fld_base
++ base_var5.field_head_tmpl_defn_var_base
++ base_var6.field1_base_tmpl_defn_var_base_ptr->field_head_tmpl_defn_ptr_base
++ base_var6.field1_base_tmpl_defn_var_base_fld.field_head_tmpl_defn_fld_base
++ base_var6.field2_base_tmpl_defn_var_base_ptr->field_base_tmpl_defn_ptr_base
++ base_var6.field2_base_tmpl_defn_var_base_fld.field_base_tmpl_defn_fld_base
+;
+}
+
diff --git a/gcc/testsuite/g++.dg/other/fesd-sys.h b/gcc/testsuite/g++.dg/other/fesd-sys.h
new file mode 100644
index 00000000000..762f5878f93
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/fesd-sys.h
@@ -0,0 +1,42 @@
+#include "fesd.h"
+
+struct gstruct_base_ordy_decl_not;
+struct gstruct_base_ordy_defn_not { int field_base_ordy_defn_not; };
+
+struct gstruct_base_ordy_decl_ref_base;
+struct gstruct_base_ordy_defn_ref_base { int field_base_ordy_defn_ref_base; };
+struct gstruct_base_ordy_defn_ptr_base { int field_base_ordy_defn_ptr_base; };
+struct gstruct_base_ordy_defn_fld_base { int field_base_ordy_defn_fld_base; };
+struct gstruct_base_ordy_defn_var_base {
+ gstruct_head_ordy_decl_ref_base *field1_base_ordy_defn_var_base_inc;
+ gstruct_head_ordy_defn_ref_base *field1_base_ordy_defn_var_base_ref;
+ gstruct_head_ordy_defn_ptr_base *field1_base_ordy_defn_var_base_ptr;
+ gstruct_head_ordy_defn_fld_base field1_base_ordy_defn_var_base_fld;
+ gstruct_base_ordy_decl_ref_base *field2_base_ordy_defn_var_base_inc;
+ gstruct_base_ordy_defn_ref_base *field2_base_ordy_defn_var_base_ref;
+ gstruct_base_ordy_defn_ptr_base *field2_base_ordy_defn_var_base_ptr;
+ gstruct_base_ordy_defn_fld_base field2_base_ordy_defn_var_base_fld;
+};
+
+template< typename T > struct gstruct_base_tmpl_decl_not;
+template< typename T > struct gstruct_base_tmpl_defn_not
+{ int field_base_tmpl_defn_not; };
+
+template< typename T > struct gstruct_base_tmpl_decl_ref_base;
+template< typename T > struct gstruct_base_tmpl_defn_ref_base
+{ int field_base_tmpl_defn_ref_base; };
+template< typename T > struct gstruct_base_tmpl_defn_ptr_base
+{ int field_base_tmpl_defn_ptr_base; };
+template< typename T > struct gstruct_base_tmpl_defn_fld_base
+{ int field_base_tmpl_defn_fld_base; };
+template< typename T > struct gstruct_base_tmpl_defn_var_base {
+ gstruct_head_tmpl_decl_ref_base< T > *field1_base_tmpl_defn_var_base_inc;
+ gstruct_head_tmpl_defn_ref_base< T > *field1_base_tmpl_defn_var_base_ref;
+ gstruct_head_tmpl_defn_ptr_base< T > *field1_base_tmpl_defn_var_base_ptr;
+ gstruct_head_tmpl_defn_fld_base< T > field1_base_tmpl_defn_var_base_fld;
+ gstruct_base_tmpl_decl_ref_base< T > *field2_base_tmpl_defn_var_base_inc;
+ gstruct_base_tmpl_defn_ref_base< T > *field2_base_tmpl_defn_var_base_ref;
+ gstruct_base_tmpl_defn_ptr_base< T > *field2_base_tmpl_defn_var_base_ptr;
+ gstruct_base_tmpl_defn_fld_base< T > field2_base_tmpl_defn_var_base_fld;
+};
+
diff --git a/gcc/testsuite/g++.dg/other/fesd.h b/gcc/testsuite/g++.dg/other/fesd.h
new file mode 100644
index 00000000000..83bb15a17bd
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/fesd.h
@@ -0,0 +1,67 @@
+/*
+where from: base = matching base; head = other header
+what kind: ordy = ordinary struct; tmpl = template struct
+definition: decl = incomplete declaration; defn = full definition
+how used: not = not used; ref = by ref; ptr = through pointer;
+ fld = as field; var = as variable
+from where: base = from base; head = other header
+*/
+
+struct gstruct_head_ordy_decl_not;
+struct gstruct_head_ordy_defn_not { int field_head_ordy_defn_not; };
+
+struct gstruct_head_ordy_decl_ref_head;
+struct gstruct_head_ordy_defn_ref_head { int field_head_ordy_defn_ref_head; };
+struct gstruct_head_ordy_defn_ptr_head { int field_head_ordy_defn_ptr_head; };
+struct gstruct_head_ordy_defn_fld_head { int field_head_ordy_defn_fld_head; };
+struct gstruct_head_ordy_defn_var_head {
+ gstruct_head_ordy_decl_ref_head *field_head_ordy_defn_var_head_inc;
+ gstruct_head_ordy_defn_ref_head *field_head_ordy_defn_var_head_ref;
+ gstruct_head_ordy_defn_ptr_head *field_head_ordy_defn_var_head_ptr;
+ gstruct_head_ordy_defn_fld_head field_head_ordy_defn_var_head_fld;
+};
+extern struct gstruct_head_ordy_defn_var_head head_var1;
+
+struct gstruct_head_ordy_decl_ref_base;
+struct gstruct_head_ordy_defn_ref_base { int field_head_ordy_defn_ref_base; };
+struct gstruct_head_ordy_defn_ptr_base { int field_head_ordy_defn_ptr_base; };
+struct gstruct_head_ordy_defn_fld_base { int field_head_ordy_defn_fld_base; };
+struct gstruct_head_ordy_defn_var_base { int field_head_ordy_defn_var_base; };
+
+template< typename T > struct gstruct_head_tmpl_decl_not;
+template< typename T > struct gstruct_head_tmpl_defn_not
+{ T field_head_tmpl_defn_not; };
+
+template< typename T > struct gstruct_head_tmpl_decl_ref_head;
+template< typename T > struct gstruct_head_tmpl_defn_ref_head
+{ T field_head_tmpl_defn_ref_head; };
+template< typename T > struct gstruct_head_tmpl_defn_ptr_head
+{ T field_head_tmpl_defn_ptr_head; };
+template< typename T > struct gstruct_head_tmpl_defn_fld_head
+{ T field_head_tmpl_defn_fld_head; };
+template< typename T > struct gstruct_head_tmpl_defn_var_head {
+ gstruct_head_tmpl_decl_ref_head< T > *field_head_tmpl_defn_var_head_inc;
+ gstruct_head_tmpl_defn_ref_head< T > *field_head_tmpl_defn_var_head_ref;
+ gstruct_head_tmpl_defn_ptr_head< T > *field_head_tmpl_defn_var_head_ptr;
+ gstruct_head_tmpl_defn_fld_head< T > field_head_tmpl_defn_var_head_fld;
+};
+extern gstruct_head_tmpl_defn_var_head< int > head_var5;
+
+template< typename T > struct gstruct_head_tmpl_decl_ref_base;
+template< typename T > struct gstruct_head_tmpl_defn_ref_base
+{ T field_head_tmpl_defn_ref_base; };
+template< typename T > struct gstruct_head_tmpl_defn_ptr_base
+{ T field_head_tmpl_defn_ptr_base; };
+template< typename T > struct gstruct_head_tmpl_defn_fld_base
+{ T field_head_tmpl_defn_fld_base; };
+template< typename T > struct gstruct_head_tmpl_defn_var_base
+{ T field_head_tmpl_defn_var_base; };
+
+inline int head_function() {
+ return 0
++ head_var1.field_head_ordy_defn_var_head_ptr->field_head_ordy_defn_ptr_head
++ head_var1.field_head_ordy_defn_var_head_fld.field_head_ordy_defn_fld_head
++ head_var5.field_head_tmpl_defn_var_head_ptr->field_head_tmpl_defn_ptr_head
++ head_var5.field_head_tmpl_defn_var_head_fld.field_head_tmpl_defn_fld_head
+;
+}
diff --git a/gcc/testsuite/gcc.dg/fesd-any.c b/gcc/testsuite/gcc.dg/fesd-any.c
new file mode 100644
index 00000000000..fc510903c2c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/fesd-any.c
@@ -0,0 +1,84 @@
+// { dg-do compile }
+// { dg-options "-gdwarf-2 -dA -femit-struct-debug-detailed=any" }
+// { dg-final { scan-assembler "timespec.*DW_AT_name" } }
+// { dg-final { scan-assembler "tv_sec.*DW_AT_name" } }
+// { dg-final { scan-assembler "tv_nsec.*DW_AT_name" } }
+// { dg-final { scan-assembler "itimerspec.*DW_AT_name" } }
+// { dg-final { scan-assembler "it_interval.*DW_AT_name" } }
+// { dg-final { scan-assembler "it_value.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_ordy_defn_ref_head.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_head_ordy_defn_ref_head.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_ordy_defn_ptr_head.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_head_ordy_defn_ptr_head.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_ordy_defn_fld_head.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_head_ordy_defn_fld_head.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_ordy_defn_var_head.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_head_ordy_defn_var_head_inc.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_head_ordy_defn_var_head_ref.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_head_ordy_defn_var_head_ptr.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_head_ordy_defn_var_head_fld.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_ordy_decl_ref_head.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_ordy_defn_ref_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_head_ordy_defn_ref_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_ordy_defn_ptr_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_head_ordy_defn_ptr_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_ordy_defn_fld_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_head_ordy_defn_fld_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_ordy_defn_var_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_head_ordy_defn_var_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_ordy_defn_ref_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_base_ordy_defn_ref_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_ordy_defn_ptr_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_base_ordy_defn_ptr_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_ordy_defn_fld_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_base_ordy_defn_fld_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_ordy_defn_var_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "field1_base_ordy_defn_var_base_inc.*DW_AT_name" } }
+// { dg-final { scan-assembler "field1_base_ordy_defn_var_base_ref.*DW_AT_name" } }
+// { dg-final { scan-assembler "field1_base_ordy_defn_var_base_ptr.*DW_AT_name" } }
+// { dg-final { scan-assembler "field1_base_ordy_defn_var_base_fld.*DW_AT_name" } }
+// { dg-final { scan-assembler "field2_base_ordy_defn_var_base_inc.*DW_AT_name" } }
+// { dg-final { scan-assembler "field2_base_ordy_defn_var_base_ref.*DW_AT_name" } }
+// { dg-final { scan-assembler "field2_base_ordy_defn_var_base_ptr.*DW_AT_name" } }
+// { dg-final { scan-assembler "field2_base_ordy_defn_var_base_fld.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_ordy_decl_ref_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_ordy_decl_ref_base.*DW_AT_name" } }
+# 1 "fesd-any.c"
+# 1 "<built-in>"
+# 1 "<command-line>"
+# 1 "fesd-any.c"
+
+//#include "time.h"
+# 1 "time.h" 1 3 4
+struct timespec
+ {
+ long int tv_sec;
+ long int tv_nsec;
+ };
+
+struct itimerspec
+ {
+ struct timespec it_interval;
+ struct timespec it_value;
+ };
+
+# 6 "fesd-any.c" 2
+
+struct timespec base_var8;
+struct itimerspec *base_var9;
+
+#include "fesd-any.h"
+
+struct gstruct_head_ordy_defn_var_base base_var1;
+struct gstruct_base_ordy_defn_var_base base_var2;
+
+int base_function() {
+ return 0
++ base_var1.field_head_ordy_defn_var_base
++ base_var2.field1_base_ordy_defn_var_base_ptr->field_head_ordy_defn_ptr_base
++ base_var2.field1_base_ordy_defn_var_base_fld.field_head_ordy_defn_fld_base
++ base_var2.field2_base_ordy_defn_var_base_ptr->field_base_ordy_defn_ptr_base
++ base_var2.field2_base_ordy_defn_var_base_fld.field_base_ordy_defn_fld_base
+;
+}
+
diff --git a/gcc/testsuite/gcc.dg/fesd-any.h b/gcc/testsuite/gcc.dg/fesd-any.h
new file mode 100644
index 00000000000..a7146b65e31
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/fesd-any.h
@@ -0,0 +1,19 @@
+#include "fesd.h"
+
+struct gstruct_base_ordy_decl_not;
+struct gstruct_base_ordy_defn_not { int field_base_ordy_defn_not; };
+
+struct gstruct_base_ordy_decl_ref_base;
+struct gstruct_base_ordy_defn_ref_base { int field_base_ordy_defn_ref_base; };
+struct gstruct_base_ordy_defn_ptr_base { int field_base_ordy_defn_ptr_base; };
+struct gstruct_base_ordy_defn_fld_base { int field_base_ordy_defn_fld_base; };
+struct gstruct_base_ordy_defn_var_base {
+ struct gstruct_head_ordy_decl_ref_base *field1_base_ordy_defn_var_base_inc;
+ struct gstruct_head_ordy_defn_ref_base *field1_base_ordy_defn_var_base_ref;
+ struct gstruct_head_ordy_defn_ptr_base *field1_base_ordy_defn_var_base_ptr;
+ struct gstruct_head_ordy_defn_fld_base field1_base_ordy_defn_var_base_fld;
+ struct gstruct_base_ordy_decl_ref_base *field2_base_ordy_defn_var_base_inc;
+ struct gstruct_base_ordy_defn_ref_base *field2_base_ordy_defn_var_base_ref;
+ struct gstruct_base_ordy_defn_ptr_base *field2_base_ordy_defn_var_base_ptr;
+ struct gstruct_base_ordy_defn_fld_base field2_base_ordy_defn_var_base_fld;
+};
diff --git a/gcc/testsuite/gcc.dg/fesd-baseonly.c b/gcc/testsuite/gcc.dg/fesd-baseonly.c
new file mode 100644
index 00000000000..a32abb5a2e2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/fesd-baseonly.c
@@ -0,0 +1,83 @@
+// { dg-do compile }
+// { dg-options "-gdwarf-2 -dA -femit-struct-debug-baseonly" }
+// { dg-final { scan-assembler "timespec.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "tv_sec.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "tv_nsec.*DW_AT_name" } }
+// { dg-final { scan-assembler "itimerspec.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "it_interval.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "it_value.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_head_ordy_defn_ref_head.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_ref_head.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_head_ordy_defn_ptr_head.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_ptr_head.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_head_ordy_defn_fld_head.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_fld_head.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_ordy_defn_var_head.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_var_head_inc.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_var_head_ref.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_var_head_ptr.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_var_head_fld.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_head_ordy_decl_ref_head.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_ordy_defn_ref_base.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_ref_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_ordy_defn_ptr_base.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_ptr_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_ordy_defn_fld_base.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_fld_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_ordy_defn_var_base.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_var_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_ordy_defn_ref_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_base_ordy_defn_ref_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_ordy_defn_ptr_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_base_ordy_defn_ptr_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_ordy_defn_fld_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_base_ordy_defn_fld_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_ordy_defn_var_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "field1_base_ordy_defn_var_base_inc.*DW_AT_name" } }
+// { dg-final { scan-assembler "field1_base_ordy_defn_var_base_ref.*DW_AT_name" } }
+// { dg-final { scan-assembler "field1_base_ordy_defn_var_base_ptr.*DW_AT_name" } }
+// { dg-final { scan-assembler "field1_base_ordy_defn_var_base_fld.*DW_AT_name" } }
+// { dg-final { scan-assembler "field2_base_ordy_defn_var_base_inc.*DW_AT_name" } }
+// { dg-final { scan-assembler "field2_base_ordy_defn_var_base_ref.*DW_AT_name" } }
+// { dg-final { scan-assembler "field2_base_ordy_defn_var_base_ptr.*DW_AT_name" } }
+// { dg-final { scan-assembler "field2_base_ordy_defn_var_base_fld.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_ordy_decl_ref_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_ordy_decl_ref_base.*DW_AT_name" } }
+# 1 "fesd-baseonly.c"
+# 1 "<built-in>"
+# 1 "<command-line>"
+# 1 "fesd-baseonly.c"
+
+//#include "time.h"
+# 1 "time.h" 1 3 4
+struct timespec
+ {
+ long int tv_sec;
+ long int tv_nsec;
+ };
+
+struct itimerspec
+ {
+ struct timespec it_interval;
+ struct timespec it_value;
+ };
+
+# 6 "fesd-baseonly.c" 2
+
+struct timespec base_var8;
+struct itimerspec *base_var9;
+
+#include "fesd-baseonly.h"
+
+struct gstruct_head_ordy_defn_var_base base_var1;
+struct gstruct_base_ordy_defn_var_base base_var2;
+
+int base_function() {
+ return 0
++ base_var1.field_head_ordy_defn_var_base
++ base_var2.field1_base_ordy_defn_var_base_ptr->field_head_ordy_defn_ptr_base
++ base_var2.field1_base_ordy_defn_var_base_fld.field_head_ordy_defn_fld_base
++ base_var2.field2_base_ordy_defn_var_base_ptr->field_base_ordy_defn_ptr_base
++ base_var2.field2_base_ordy_defn_var_base_fld.field_base_ordy_defn_fld_base
+;
+}
diff --git a/gcc/testsuite/gcc.dg/fesd-baseonly.h b/gcc/testsuite/gcc.dg/fesd-baseonly.h
new file mode 100644
index 00000000000..a7146b65e31
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/fesd-baseonly.h
@@ -0,0 +1,19 @@
+#include "fesd.h"
+
+struct gstruct_base_ordy_decl_not;
+struct gstruct_base_ordy_defn_not { int field_base_ordy_defn_not; };
+
+struct gstruct_base_ordy_decl_ref_base;
+struct gstruct_base_ordy_defn_ref_base { int field_base_ordy_defn_ref_base; };
+struct gstruct_base_ordy_defn_ptr_base { int field_base_ordy_defn_ptr_base; };
+struct gstruct_base_ordy_defn_fld_base { int field_base_ordy_defn_fld_base; };
+struct gstruct_base_ordy_defn_var_base {
+ struct gstruct_head_ordy_decl_ref_base *field1_base_ordy_defn_var_base_inc;
+ struct gstruct_head_ordy_defn_ref_base *field1_base_ordy_defn_var_base_ref;
+ struct gstruct_head_ordy_defn_ptr_base *field1_base_ordy_defn_var_base_ptr;
+ struct gstruct_head_ordy_defn_fld_base field1_base_ordy_defn_var_base_fld;
+ struct gstruct_base_ordy_decl_ref_base *field2_base_ordy_defn_var_base_inc;
+ struct gstruct_base_ordy_defn_ref_base *field2_base_ordy_defn_var_base_ref;
+ struct gstruct_base_ordy_defn_ptr_base *field2_base_ordy_defn_var_base_ptr;
+ struct gstruct_base_ordy_defn_fld_base field2_base_ordy_defn_var_base_fld;
+};
diff --git a/gcc/testsuite/gcc.dg/fesd-none.c b/gcc/testsuite/gcc.dg/fesd-none.c
new file mode 100644
index 00000000000..bd218f82615
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/fesd-none.c
@@ -0,0 +1,84 @@
+// { dg-do compile }
+// { dg-options "-gdwarf-2 -dA -femit-struct-debug-detailed=none" }
+// { dg-final { scan-assembler "timespec.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "tv_sec.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "tv_nsec.*DW_AT_name" } }
+// { dg-final { scan-assembler "itimerspec.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "it_interval.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "it_value.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_head_ordy_defn_ref_head.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_ref_head.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_head_ordy_defn_ptr_head.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_ptr_head.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_head_ordy_defn_fld_head.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_fld_head.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_ordy_defn_var_head.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_var_head_inc.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_var_head_ref.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_var_head_ptr.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_var_head_fld.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_head_ordy_decl_ref_head.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_head_ordy_defn_ref_base.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_ref_base.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_head_ordy_defn_ptr_base.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_ptr_base.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_head_ordy_defn_fld_base.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_fld_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_ordy_defn_var_base.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_var_base.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_base_ordy_defn_ref_base.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_base_ordy_defn_ref_base.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_base_ordy_defn_ptr_base.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_base_ordy_defn_ptr_base.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_base_ordy_defn_fld_base.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_base_ordy_defn_fld_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_ordy_defn_var_base.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field1_base_ordy_defn_var_base_inc.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field1_base_ordy_defn_var_base_ref.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field1_base_ordy_defn_var_base_ptr.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field1_base_ordy_defn_var_base_fld.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field2_base_ordy_defn_var_base_inc.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field2_base_ordy_defn_var_base_ref.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field2_base_ordy_defn_var_base_ptr.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field2_base_ordy_defn_var_base_fld.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_head_ordy_decl_ref_base.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_base_ordy_decl_ref_base.*DW_AT_name" } }
+# 1 "fesd-none.c"
+# 1 "<built-in>"
+# 1 "<command-line>"
+# 1 "fesd-none.c"
+
+//#include "time.h"
+# 1 "time.h" 1 3 4
+struct timespec
+ {
+ long int tv_sec;
+ long int tv_nsec;
+ };
+
+struct itimerspec
+ {
+ struct timespec it_interval;
+ struct timespec it_value;
+ };
+
+# 6 "fesd-none.c" 2
+
+struct timespec base_var8;
+struct itimerspec *base_var9;
+
+#include "fesd-none.h"
+
+struct gstruct_head_ordy_defn_var_base base_var1;
+struct gstruct_base_ordy_defn_var_base base_var2;
+
+int base_function() {
+ return 0
++ base_var1.field_head_ordy_defn_var_base
++ base_var2.field1_base_ordy_defn_var_base_ptr->field_head_ordy_defn_ptr_base
++ base_var2.field1_base_ordy_defn_var_base_fld.field_head_ordy_defn_fld_base
++ base_var2.field2_base_ordy_defn_var_base_ptr->field_base_ordy_defn_ptr_base
++ base_var2.field2_base_ordy_defn_var_base_fld.field_base_ordy_defn_fld_base
+;
+}
+
diff --git a/gcc/testsuite/gcc.dg/fesd-none.h b/gcc/testsuite/gcc.dg/fesd-none.h
new file mode 100644
index 00000000000..a7146b65e31
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/fesd-none.h
@@ -0,0 +1,19 @@
+#include "fesd.h"
+
+struct gstruct_base_ordy_decl_not;
+struct gstruct_base_ordy_defn_not { int field_base_ordy_defn_not; };
+
+struct gstruct_base_ordy_decl_ref_base;
+struct gstruct_base_ordy_defn_ref_base { int field_base_ordy_defn_ref_base; };
+struct gstruct_base_ordy_defn_ptr_base { int field_base_ordy_defn_ptr_base; };
+struct gstruct_base_ordy_defn_fld_base { int field_base_ordy_defn_fld_base; };
+struct gstruct_base_ordy_defn_var_base {
+ struct gstruct_head_ordy_decl_ref_base *field1_base_ordy_defn_var_base_inc;
+ struct gstruct_head_ordy_defn_ref_base *field1_base_ordy_defn_var_base_ref;
+ struct gstruct_head_ordy_defn_ptr_base *field1_base_ordy_defn_var_base_ptr;
+ struct gstruct_head_ordy_defn_fld_base field1_base_ordy_defn_var_base_fld;
+ struct gstruct_base_ordy_decl_ref_base *field2_base_ordy_defn_var_base_inc;
+ struct gstruct_base_ordy_defn_ref_base *field2_base_ordy_defn_var_base_ref;
+ struct gstruct_base_ordy_defn_ptr_base *field2_base_ordy_defn_var_base_ptr;
+ struct gstruct_base_ordy_defn_fld_base field2_base_ordy_defn_var_base_fld;
+};
diff --git a/gcc/testsuite/gcc.dg/fesd-reduced.c b/gcc/testsuite/gcc.dg/fesd-reduced.c
new file mode 100644
index 00000000000..ac599f43fbf
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/fesd-reduced.c
@@ -0,0 +1,83 @@
+// { dg-do compile }
+// { dg-options "-gdwarf-2 -dA -femit-struct-debug-reduced" }
+// { dg-final { scan-assembler "timespec.*DW_AT_name" } }
+// { dg-final { scan-assembler "tv_sec.*DW_AT_name" } }
+// { dg-final { scan-assembler "tv_nsec.*DW_AT_name" } }
+// { dg-final { scan-assembler "itimerspec.*DW_AT_name" } }
+// { dg-final { scan-assembler "it_interval.*DW_AT_name" } }
+// { dg-final { scan-assembler "it_value.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_head_ordy_defn_ref_head.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_ref_head.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_head_ordy_defn_ptr_head.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_ptr_head.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_head_ordy_defn_fld_head.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_fld_head.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_ordy_defn_var_head.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_var_head_inc.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_var_head_ref.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_var_head_ptr.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_var_head_fld.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_head_ordy_decl_ref_head.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_ordy_defn_ref_base.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_ref_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_ordy_defn_ptr_base.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_ptr_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_ordy_defn_fld_base.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_fld_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_ordy_defn_var_base.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_var_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_ordy_defn_ref_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_base_ordy_defn_ref_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_ordy_defn_ptr_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_base_ordy_defn_ptr_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_ordy_defn_fld_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_base_ordy_defn_fld_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_ordy_defn_var_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "field1_base_ordy_defn_var_base_inc.*DW_AT_name" } }
+// { dg-final { scan-assembler "field1_base_ordy_defn_var_base_ref.*DW_AT_name" } }
+// { dg-final { scan-assembler "field1_base_ordy_defn_var_base_ptr.*DW_AT_name" } }
+// { dg-final { scan-assembler "field1_base_ordy_defn_var_base_fld.*DW_AT_name" } }
+// { dg-final { scan-assembler "field2_base_ordy_defn_var_base_inc.*DW_AT_name" } }
+// { dg-final { scan-assembler "field2_base_ordy_defn_var_base_ref.*DW_AT_name" } }
+// { dg-final { scan-assembler "field2_base_ordy_defn_var_base_ptr.*DW_AT_name" } }
+// { dg-final { scan-assembler "field2_base_ordy_defn_var_base_fld.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_ordy_decl_ref_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_ordy_decl_ref_base.*DW_AT_name" } }
+# 1 "fesd-reduced.c"
+# 1 "<built-in>"
+# 1 "<command-line>"
+# 1 "fesd-reduced.c"
+
+//#include "time.h"
+# 1 "time.h" 1 3 4
+struct timespec
+ {
+ long int tv_sec;
+ long int tv_nsec;
+ };
+
+struct itimerspec
+ {
+ struct timespec it_interval;
+ struct timespec it_value;
+ };
+
+# 6 "fesd-reduced.c" 2
+
+struct timespec base_var8;
+struct itimerspec *base_var9;
+
+#include "fesd-reduced.h"
+
+struct gstruct_head_ordy_defn_var_base base_var1;
+struct gstruct_base_ordy_defn_var_base base_var2;
+
+int base_function() {
+ return 0
++ base_var1.field_head_ordy_defn_var_base
++ base_var2.field1_base_ordy_defn_var_base_ptr->field_head_ordy_defn_ptr_base
++ base_var2.field1_base_ordy_defn_var_base_fld.field_head_ordy_defn_fld_base
++ base_var2.field2_base_ordy_defn_var_base_ptr->field_base_ordy_defn_ptr_base
++ base_var2.field2_base_ordy_defn_var_base_fld.field_base_ordy_defn_fld_base
+;
+}
diff --git a/gcc/testsuite/gcc.dg/fesd-reduced.h b/gcc/testsuite/gcc.dg/fesd-reduced.h
new file mode 100644
index 00000000000..a7146b65e31
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/fesd-reduced.h
@@ -0,0 +1,19 @@
+#include "fesd.h"
+
+struct gstruct_base_ordy_decl_not;
+struct gstruct_base_ordy_defn_not { int field_base_ordy_defn_not; };
+
+struct gstruct_base_ordy_decl_ref_base;
+struct gstruct_base_ordy_defn_ref_base { int field_base_ordy_defn_ref_base; };
+struct gstruct_base_ordy_defn_ptr_base { int field_base_ordy_defn_ptr_base; };
+struct gstruct_base_ordy_defn_fld_base { int field_base_ordy_defn_fld_base; };
+struct gstruct_base_ordy_defn_var_base {
+ struct gstruct_head_ordy_decl_ref_base *field1_base_ordy_defn_var_base_inc;
+ struct gstruct_head_ordy_defn_ref_base *field1_base_ordy_defn_var_base_ref;
+ struct gstruct_head_ordy_defn_ptr_base *field1_base_ordy_defn_var_base_ptr;
+ struct gstruct_head_ordy_defn_fld_base field1_base_ordy_defn_var_base_fld;
+ struct gstruct_base_ordy_decl_ref_base *field2_base_ordy_defn_var_base_inc;
+ struct gstruct_base_ordy_defn_ref_base *field2_base_ordy_defn_var_base_ref;
+ struct gstruct_base_ordy_defn_ptr_base *field2_base_ordy_defn_var_base_ptr;
+ struct gstruct_base_ordy_defn_fld_base field2_base_ordy_defn_var_base_fld;
+};
diff --git a/gcc/testsuite/gcc.dg/fesd-sys.c b/gcc/testsuite/gcc.dg/fesd-sys.c
new file mode 100644
index 00000000000..3a5c0bf1463
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/fesd-sys.c
@@ -0,0 +1,83 @@
+// { dg-do compile }
+// { dg-options "-gdwarf-2 -dA -femit-struct-debug-detailed=sys" }
+// { dg-final { scan-assembler "timespec.*DW_AT_name" } }
+// { dg-final { scan-assembler "tv_sec.*DW_AT_name" } }
+// { dg-final { scan-assembler "tv_nsec.*DW_AT_name" } }
+// { dg-final { scan-assembler "itimerspec.*DW_AT_name" } }
+// { dg-final { scan-assembler "it_interval.*DW_AT_name" } }
+// { dg-final { scan-assembler "it_value.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_head_ordy_defn_ref_head.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_ref_head.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_head_ordy_defn_ptr_head.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_ptr_head.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_head_ordy_defn_fld_head.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_fld_head.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_ordy_defn_var_head.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_var_head_inc.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_var_head_ref.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_var_head_ptr.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_var_head_fld.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "gstruct_head_ordy_decl_ref_head.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_ordy_defn_ref_base.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_ref_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_ordy_defn_ptr_base.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_ptr_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_ordy_defn_fld_base.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_fld_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_ordy_defn_var_base.*DW_AT_name" } }
+// { dg-final { scan-assembler-not "field_head_ordy_defn_var_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_ordy_defn_ref_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_base_ordy_defn_ref_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_ordy_defn_ptr_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_base_ordy_defn_ptr_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_ordy_defn_fld_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "field_base_ordy_defn_fld_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_ordy_defn_var_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "field1_base_ordy_defn_var_base_inc.*DW_AT_name" } }
+// { dg-final { scan-assembler "field1_base_ordy_defn_var_base_ref.*DW_AT_name" } }
+// { dg-final { scan-assembler "field1_base_ordy_defn_var_base_ptr.*DW_AT_name" } }
+// { dg-final { scan-assembler "field1_base_ordy_defn_var_base_fld.*DW_AT_name" } }
+// { dg-final { scan-assembler "field2_base_ordy_defn_var_base_inc.*DW_AT_name" } }
+// { dg-final { scan-assembler "field2_base_ordy_defn_var_base_ref.*DW_AT_name" } }
+// { dg-final { scan-assembler "field2_base_ordy_defn_var_base_ptr.*DW_AT_name" } }
+// { dg-final { scan-assembler "field2_base_ordy_defn_var_base_fld.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_head_ordy_decl_ref_base.*DW_AT_name" } }
+// { dg-final { scan-assembler "gstruct_base_ordy_decl_ref_base.*DW_AT_name" } }
+# 1 "fesd-sys.c"
+# 1 "<built-in>"
+# 1 "<command-line>"
+# 1 "fesd-sys.c"
+
+//#include "time.h"
+# 1 "time.h" 1 3 4
+struct timespec
+ {
+ long int tv_sec;
+ long int tv_nsec;
+ };
+
+struct itimerspec
+ {
+ struct timespec it_interval;
+ struct timespec it_value;
+ };
+
+# 6 "fesd-sys.c" 2
+
+struct timespec base_var8;
+struct itimerspec *base_var9;
+
+#include "fesd-sys.h"
+
+struct gstruct_head_ordy_defn_var_base base_var1;
+struct gstruct_base_ordy_defn_var_base base_var2;
+
+int base_function() {
+ return 0
++ base_var1.field_head_ordy_defn_var_base
++ base_var2.field1_base_ordy_defn_var_base_ptr->field_head_ordy_defn_ptr_base
++ base_var2.field1_base_ordy_defn_var_base_fld.field_head_ordy_defn_fld_base
++ base_var2.field2_base_ordy_defn_var_base_ptr->field_base_ordy_defn_ptr_base
++ base_var2.field2_base_ordy_defn_var_base_fld.field_base_ordy_defn_fld_base
+;
+}
diff --git a/gcc/testsuite/gcc.dg/fesd-sys.h b/gcc/testsuite/gcc.dg/fesd-sys.h
new file mode 100644
index 00000000000..a7146b65e31
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/fesd-sys.h
@@ -0,0 +1,19 @@
+#include "fesd.h"
+
+struct gstruct_base_ordy_decl_not;
+struct gstruct_base_ordy_defn_not { int field_base_ordy_defn_not; };
+
+struct gstruct_base_ordy_decl_ref_base;
+struct gstruct_base_ordy_defn_ref_base { int field_base_ordy_defn_ref_base; };
+struct gstruct_base_ordy_defn_ptr_base { int field_base_ordy_defn_ptr_base; };
+struct gstruct_base_ordy_defn_fld_base { int field_base_ordy_defn_fld_base; };
+struct gstruct_base_ordy_defn_var_base {
+ struct gstruct_head_ordy_decl_ref_base *field1_base_ordy_defn_var_base_inc;
+ struct gstruct_head_ordy_defn_ref_base *field1_base_ordy_defn_var_base_ref;
+ struct gstruct_head_ordy_defn_ptr_base *field1_base_ordy_defn_var_base_ptr;
+ struct gstruct_head_ordy_defn_fld_base field1_base_ordy_defn_var_base_fld;
+ struct gstruct_base_ordy_decl_ref_base *field2_base_ordy_defn_var_base_inc;
+ struct gstruct_base_ordy_defn_ref_base *field2_base_ordy_defn_var_base_ref;
+ struct gstruct_base_ordy_defn_ptr_base *field2_base_ordy_defn_var_base_ptr;
+ struct gstruct_base_ordy_defn_fld_base field2_base_ordy_defn_var_base_fld;
+};
diff --git a/gcc/testsuite/gcc.dg/fesd.h b/gcc/testsuite/gcc.dg/fesd.h
new file mode 100644
index 00000000000..46b24f5e9e1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/fesd.h
@@ -0,0 +1,36 @@
+/*
+where from: base = matching base; head = other header
+what kind: ordy = ordinary struct; tmpl = template struct
+definition: decl = incomplete declaration; defn = full definition
+how used: not = not used; ref = by ref; ptr = through pointer;
+ fld = as field; var = as variable
+from where: base = from base; head = other header
+*/
+
+struct gstruct_head_ordy_decl_not;
+struct gstruct_head_ordy_defn_not { int field_head_ordy_defn_not; };
+
+struct gstruct_head_ordy_decl_ref_head;
+struct gstruct_head_ordy_defn_ref_head { int field_head_ordy_defn_ref_head; };
+struct gstruct_head_ordy_defn_ptr_head { int field_head_ordy_defn_ptr_head; };
+struct gstruct_head_ordy_defn_fld_head { int field_head_ordy_defn_fld_head; };
+struct gstruct_head_ordy_defn_var_head {
+ struct gstruct_head_ordy_decl_ref_head *field_head_ordy_defn_var_head_inc;
+ struct gstruct_head_ordy_defn_ref_head *field_head_ordy_defn_var_head_ref;
+ struct gstruct_head_ordy_defn_ptr_head *field_head_ordy_defn_var_head_ptr;
+ struct gstruct_head_ordy_defn_fld_head field_head_ordy_defn_var_head_fld;
+};
+extern struct gstruct_head_ordy_defn_var_head head_var1;
+
+struct gstruct_head_ordy_decl_ref_base;
+struct gstruct_head_ordy_defn_ref_base { int field_head_ordy_defn_ref_base; };
+struct gstruct_head_ordy_defn_ptr_base { int field_head_ordy_defn_ptr_base; };
+struct gstruct_head_ordy_defn_fld_base { int field_head_ordy_defn_fld_base; };
+struct gstruct_head_ordy_defn_var_base { int field_head_ordy_defn_var_base; };
+
+inline int head_function() {
+ return 0
++ head_var1.field_head_ordy_defn_var_head_ptr->field_head_ordy_defn_ptr_head
++ head_var1.field_head_ordy_defn_var_head_fld.field_head_ordy_defn_fld_head
+;
+}
OpenPOWER on IntegriCloud