http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49565

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-06-28 
16:45:35 UTC ---
There are two issues:

 a) The one mentioned by Jakub for the committal cited in comment 1
    That seems to be a DWARF bug - and Tromey has now filled an issue; it
should
    show up in a while at http://www.dwarfstd.org/Issues.php

    The problem is that DW_TAG_string_type does not support DW_AT_type,
    which makes it not suitable for character(kind=4) [as it already has to
    handle character(kind=1)].

 b) Independent of that issue, GCC should emit DW_ATE_unsigned_char and not
    DW_ATE_unsigned


The latter issue seems to come due to the following code in gen_array_type_die:

  if (TYPE_STRING_FLAG (type)
      /* Case handling kind=1 characters. */
    {
      ...
      return;
    }
  ...
  /* For Fortran multidimensional arrays use DW_ORD_col_major ordering.  */
  if (is_fortran ()
      && TREE_CODE (type) == ARRAY_TYPE
      && TREE_CODE (TREE_TYPE (type)) == ARRAY_TYPE
      && !TYPE_STRING_FLAG (TREE_TYPE (type)))
    add_AT_unsigned (array_die, DW_AT_ordering, DW_ORD_col_major);

This test is true as:
  (gdb) p type->type_common.string_flag
  $6 = 1
  (gdb) p type->typed.type->type_common.string_flag
  $7 = 0

I wonder whether the
     && !TYPE_STRING_FLAG (TREE_TYPE (type)))
shouldn't be instead a
     && !TYPE_STRING_FLAG (type))

Or alternatively, whether fortran/trans-type.c's
gfc_get_character_type_len_for_eltype should not only set
  TYPE_STRING_FLAG (type) = 1;
but also
  TYPE_STRING_FLAG (TREE_TYPE (type)) = 1;

Reply via email to