diff options
author | Jakub Jelinek <jakub@redhat.com> | 2007-09-20 23:27:39 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2007-09-20 23:27:39 +0200 |
commit | cc459ab40ad75779ba111199bd75437399251cc3 (patch) | |
tree | aa728aafbbc6b2e5ac493d4b21912cb46a44cf1f /gcc | |
parent | 4745e4eb75aed535cc05f3393dd1209ffd8bac09 (diff) | |
download | gcc-cc459ab40ad75779ba111199bd75437399251cc3.zip gcc-cc459ab40ad75779ba111199bd75437399251cc3.tar.gz gcc-cc459ab40ad75779ba111199bd75437399251cc3.tar.bz2 |
re PR debug/33316 (ICE on valid variable-length automatic array in const struct)
PR debug/33316
* dwarf2out.c (modified_type_die): Handle TYPE_DECL with NULL
DECL_NAME.
* dbxout.c (dbxout_type): Likewise.
* gcc.dg/debug/pr33316.c: New test.
From-SVN: r128631
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/dbxout.c | 6 | ||||
-rw-r--r-- | gcc/dwarf2out.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/debug/pr33316.c | 15 |
5 files changed, 30 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d2f5a59..1a69d02 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,10 @@ 2007-09-20 Jakub Jelinek <jakub@redhat.com> + PR debug/33316 + * dwarf2out.c (modified_type_die): Handle TYPE_DECL with NULL + DECL_NAME. + * dbxout.c (dbxout_type): Likewise. + PR c/33238 PR c/27301 * gimplify.c (gimplify_vla_decl): New function. diff --git a/gcc/dbxout.c b/gcc/dbxout.c index 2494eda..ad1b3c7 100644 --- a/gcc/dbxout.c +++ b/gcc/dbxout.c @@ -2029,7 +2029,11 @@ dbxout_type (tree type, int full) another type's definition; instead, output an xref and let the definition come when the name is defined. */ stabstr_S ((TREE_CODE (type) == RECORD_TYPE) ? "xs" : "xu"); - if (TYPE_NAME (type) != 0) + if (TYPE_NAME (type) != 0 + /* The C frontend creates for anonymous variable length + records/unions TYPE_NAME with DECL_NAME NULL. */ + && (TREE_CODE (TYPE_NAME (type)) != TYPE_DECL + || DECL_NAME (TYPE_NAME (type)))) dbxout_type_name (type); else { diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 527de82..3164d70 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -8724,7 +8724,8 @@ modified_type_die (tree type, int is_const_type, int is_volatile_type, don't output a DW_TAG_typedef, since there isn't one in the user's program; just attach a DW_AT_name to the type. */ if (name - && (TREE_CODE (name) != TYPE_DECL || TREE_TYPE (name) == qualified_type)) + && (TREE_CODE (name) != TYPE_DECL + || (TREE_TYPE (name) == qualified_type && DECL_NAME (name)))) { if (TREE_CODE (name) == TYPE_DECL) /* Could just call add_name_and_src_coords_attributes here, diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f1186e8..9974bc3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2007-09-20 Jakub Jelinek <jakub@redhat.com> + PR debug/33316 + * gcc.dg/debug/pr33316.c: New test. + PR c++/33496 * g++.dg/cpp0x/variadic76.C: New test. * g++.dg/cpp0x/variadic77.C: New test. diff --git a/gcc/testsuite/gcc.dg/debug/pr33316.c b/gcc/testsuite/gcc.dg/debug/pr33316.c new file mode 100644 index 0000000..d43478b --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/pr33316.c @@ -0,0 +1,15 @@ +/* PR debug/33316 */ + +int +foo (void *x, int y) +{ + const struct { int d[y]; } *a = x; + return a[0].d[0]; +} + +int +bar (void *x, int y) +{ + const struct S { int d[y]; } *a = x; + return a[0].d[0]; +} |