This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix PR debug/7241 (regression from 2.95.x)


Hi!

The following patch fixes PR debug/7241. For say
const char *x;
we emit:
...
        .uleb128 0x5    # (DIE (0x40) DW_TAG_base_type)
        .long   .LC2    # DW_AT_name: "char"
        .byte   0x1     # DW_AT_byte_size
        .byte   0x5     # DW_AT_encoding
...
.LC2:
        .string "char"

That is because the type passed to base_type_die is neither "signed char",
nor "unsigned char", but not char_type_node either (it is a qual variant
of char with name "char").
I think if TYPE_MAIN_VARIANT is char_type_node and the name of the type
is "char", it is reasonably safe to assume it is really DW_ATE_*_char, not
integer CHAR_TYPE_SIZE wide.
Ok to commit?

2002-07-11  Jakub Jelinek  <jakub@redhat.com>

	PR debug/7241
	* dwarf2out.c (base_type_die): Use DW_ATE_*_char even if main
	variant is char_type_node and type name is char.

--- gcc/dwarf2out.c.jj	Wed Jun 19 15:09:56 2002
+++ gcc/dwarf2out.c	Thu Jul 11 20:47:52 2002
@@ -7335,9 +7335,11 @@ base_type_die (type)
       /* Carefully distinguish the C character types, without messing
          up if the language is not C. Note that we check only for the names
          that contain spaces; other names might occur by coincidence in other
-         languages.  */
+         languages, so we only check if main variant is char_type_node.  */
       if (! (TYPE_PRECISION (type) == CHAR_TYPE_SIZE
 	     && (type == char_type_node
+		 || (TYPE_MAIN_VARIANT (type) == char_type_node
+		     && ! strcmp (type_name, "char"))
 		 || ! strcmp (type_name, "signed char")
 		 || ! strcmp (type_name, "unsigned char"))))
 	{

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]