This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] PR debug/30189
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 03 Jan 2007 15:00:24 -0200
- Subject: [PATCH] PR debug/30189
Hi,
gen_type_die() follows DECL_ORIGINAL_TYPE (TYPE_NAME (type)), so if
modified_type_die() doesn't, it ends up expecting a die for a type
that would never have had one emitted.
This causes an assertion failure in 4.1. The only reason it doesn't
in mainline is that the assert was removed.
The first patch below is for 4.1; the second is for mainline.
Regression-tested on x86_64-linux-gnu. Ok?
:ADDPATCH debug:
for gcc/ChangeLog
from Alexandre Oliva <aoliva@redhat.com>
PR debug/30189
* dwarf2out.c (modified_type_die): Follow DECL_ORIGINAL_TYPE
even if cv-qualification is the same.
for gcc/testsuite/ChangeLog
from Alexandre Oliva <aoliva@redhat.com>
PR debug/30189
* gcc.dg/pr30189.c: New test.
Index: gcc/dwarf2out.c
===================================================================
--- gcc/dwarf2out.c.orig 2007-01-02 17:48:15.000000000 -0200
+++ gcc/dwarf2out.c 2007-01-02 17:51:53.000000000 -0200
@@ -8407,7 +8407,10 @@ modified_type_die (tree type, int is_con
mod_type_die = lookup_type_die (qualified_type);
}
else if (is_const_type < TYPE_READONLY (dtype)
- || is_volatile_type < TYPE_VOLATILE (dtype))
+ || is_volatile_type < TYPE_VOLATILE (dtype)
+ || (is_const_type <= TYPE_READONLY (dtype)
+ && is_volatile_type <= TYPE_VOLATILE (dtype)
+ && DECL_ORIGINAL_TYPE (type_name) != type))
/* cv-unqualified version of named type. Just use the unnamed
type to which it refers. */
mod_type_die
Index: gcc/testsuite/gcc.dg/pr30189.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gcc/testsuite/gcc.dg/pr30189.c 2007-01-03 14:14:16.000000000 -0200
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-g -O" } */
+
+extern void foo (void);
+
+static
+void baz (int i)
+{
+ foo ();
+ typedef char A[i];
+ struct { A b; } *x = 0;
+}
+
+void
+bar (i)
+{
+ baz (i);
+}
for gcc/ChangeLog
from Alexandre Oliva <aoliva@redhat.com>
PR debug/30189
* dwarf2out.c (modified_type_die): Follow DECL_ORIGINAL_TYPE
even if cv-qualification is the same.
for gcc/testsuite/ChangeLog
from Alexandre Oliva <aoliva@redhat.com>
PR debug/30189
* gcc.dg/pr30189.c: New test.
Index: gcc/dwarf2out.c
===================================================================
--- gcc/dwarf2out.c.orig 2007-01-02 17:47:40.000000000 -0200
+++ gcc/dwarf2out.c 2007-01-02 17:51:38.000000000 -0200
@@ -8499,9 +8499,11 @@ modified_type_die (tree type, int is_con
gen_type_die (qualified_type, context_die);
return lookup_type_die (qualified_type);
}
- else if (DECL_ORIGINAL_TYPE (name)
- && (is_const_type < TYPE_READONLY (dtype)
- || is_volatile_type < TYPE_VOLATILE (dtype)))
+ else if (is_const_type < TYPE_READONLY (dtype)
+ || is_volatile_type < TYPE_VOLATILE (dtype)
+ || (is_const_type <= TYPE_READONLY (dtype)
+ && is_volatile_type <= TYPE_VOLATILE (dtype)
+ && DECL_ORIGINAL_TYPE (name) != type))
/* cv-unqualified version of named type. Just use the unnamed
type to which it refers. */
return modified_type_die (DECL_ORIGINAL_TYPE (name),
Index: gcc/testsuite/gcc.dg/pr30189.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gcc/testsuite/gcc.dg/pr30189.c 2007-01-03 14:13:59.000000000 -0200
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-g -O" } */
+
+extern void foo (void);
+
+static
+void baz (int i)
+{
+ foo ();
+ typedef char A[i];
+ struct { A b; } *x = 0;
+}
+
+void
+bar (i)
+{
+ baz (i);
+}
--
Alexandre Oliva http://www.lsd.ic.unicamp.br/~oliva/
FSF Latin America Board Member http://www.fsfla.org/
Red Hat Compiler Engineer aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist oliva@{lsd.ic.unicamp.br, gnu.org}