This is the mail archive of the 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 debuginfo for integer(kind=1) variables


Given e.g.:
program test
integer (kind=1), parameter :: i1 = 127_1
integer (kind=2), parameter :: i2 = 28_2
integer (kind=4), parameter :: i4 = 36_4
integer (kind=8), parameter :: i8 = 44_8
write (*,*) i1, i2, i4, i8
current gfortran emits the debug info for i1 as:
        .uleb128 0x2    # (DIE (0x2d) DW_TAG_const_type)
        .long   0x32    # DW_AT_type
        .uleb128 0x3    # (DIE (0x32) DW_TAG_base_type)
        .byte   0x1     # DW_AT_byte_size
        .byte   0x6     # DW_AT_encoding
        .long   .LASF0  # DW_AT_name: "integer(kind=1)"
        .ascii "i1\0"   # DW_AT_name
        .byte   0x1     # DW_AT_decl_file (foo.f90)
        .byte   0x2     # DW_AT_decl_line
        .long   0x2d    # DW_AT_type
        .byte   0x7f    # DW_AT_const_value
which has wrong DW_AT_encoding value for the type - DW_ATE_signed_char
instead of DW_ATE_signed.  This may be used by debuggers to decide
how to print the values.

The following patch avoids using the signed_char_type_node type (which has
TYPE_STRING_FLAG set in tree.c) for Fortran integer(kind=1) type.

Bootstrapped/regtested on x86_64-linux, ok for trunk?

2009-04-08  Jakub Jelinek  <>

	* trans-types.c (gfc_init_types): Ensure gfc_integer_types doesn't
	contain TYPE_STRING_FLAG types.

--- gcc/fortran/trans-types.c.jj	2009-04-01 18:23:03.000000000 +0200
+++ gcc/fortran/trans-types.c	2009-04-08 14:31:37.000000000 +0200
@@ -721,6 +721,9 @@ gfc_init_types (void)
   for (index = 0; gfc_integer_kinds[index].kind != 0; ++index)
       type = gfc_build_int_type (&gfc_integer_kinds[index]);
+      /* Ensure integer(kind=1) doesn't have TYPE_STRING_FLAG set.  */
+      if (TYPE_STRING_FLAG (type))
+	type = make_signed_type (gfc_integer_kinds[index].bit_size);
       gfc_integer_types[index] = type;
       snprintf (name_buf, sizeof(name_buf), "integer(kind=%d)",


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