public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/49565] New: character(kind=4) is emitted as DW_ATE_unsigned, not DW_ATE_unsigned_char
@ 2011-06-28 15:55 tromey at gcc dot gnu.org
  2011-06-28 16:08 ` [Bug fortran/49565] " burnus at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: tromey at gcc dot gnu.org @ 2011-06-28 15:55 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: character(kind=4) is emitted as DW_ATE_unsigned, not
                    DW_ATE_unsigned_char
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: tromey@gcc.gnu.org


I compiled this program with svn trunk gfortran.
I used -gdwarf-4 -g.

character(kind=4) :: c
character(kind=4,len=5) :: str
c = 4_'\u00AE'
str = 4_'\u00AE\u01DD'
open(6,encoding='utf-8')
print *, c
print *, str
end


Then I examined the DWARF.  'c' is ultimately of type:

 <1><cf>: Abbrev Number: 7 (DW_TAG_base_type)
    <d0>   DW_AT_byte_size   : 4    
    <d1>   DW_AT_encoding    : 7    (unsigned)
    <d2>   DW_AT_name        : (indirect string, offset: 0x67):
character(kind=4)    

I think the encoding should be DW_ATE_unsigned_char instead.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug fortran/49565] character(kind=4) is emitted as DW_ATE_unsigned, not DW_ATE_unsigned_char
  2011-06-28 15:55 [Bug fortran/49565] New: character(kind=4) is emitted as DW_ATE_unsigned, not DW_ATE_unsigned_char tromey at gcc dot gnu.org
@ 2011-06-28 16:08 ` burnus at gcc dot gnu.org
  2011-06-28 16:45 ` burnus at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-06-28 16:08 UTC (permalink / raw)
  To: gcc-bugs

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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu.org

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-06-28 16:07:33 UTC ---
>From gcc/dwarf2out.c's base_type_die:

      if (TYPE_STRING_FLAG (type))
    {
      if (TYPE_UNSIGNED (type))
        encoding = DW_ATE_unsigned_char;

which should set it. However, there is also in gen_array_type_die the following
code:

  /* Emit DW_TAG_string_type for Fortran character types (with kind 1 only, as
     DW_TAG_string_type doesn't have DW_AT_type attribute).  */
  if (TYPE_STRING_FLAG (type)
      && TREE_CODE (type) == ARRAY_TYPE
      && is_fortran ()
      && TYPE_MODE (TREE_TYPE (type)) == TYPE_MODE (char_type_node))

That has been added by Jakub's commit Rev. 139778:
http://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=cdba1d8f465a94f6f654bcc33a7663913df2181e;hp=98923a8420e5399f31613d93ebee61e63f2d36e1

Sumitted patch was http://gcc.gnu.org/ml/gcc-patches/2008-08/msg01680.html


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug fortran/49565] character(kind=4) is emitted as DW_ATE_unsigned, not DW_ATE_unsigned_char
  2011-06-28 15:55 [Bug fortran/49565] New: character(kind=4) is emitted as DW_ATE_unsigned, not DW_ATE_unsigned_char tromey at gcc dot gnu.org
  2011-06-28 16:08 ` [Bug fortran/49565] " burnus at gcc dot gnu.org
@ 2011-06-28 16:45 ` burnus at gcc dot gnu.org
  2011-06-28 16:55 ` burnus at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-06-28 16:45 UTC (permalink / raw)
  To: gcc-bugs

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;


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug fortran/49565] character(kind=4) is emitted as DW_ATE_unsigned, not DW_ATE_unsigned_char
  2011-06-28 15:55 [Bug fortran/49565] New: character(kind=4) is emitted as DW_ATE_unsigned, not DW_ATE_unsigned_char tromey at gcc dot gnu.org
  2011-06-28 16:08 ` [Bug fortran/49565] " burnus at gcc dot gnu.org
  2011-06-28 16:45 ` burnus at gcc dot gnu.org
@ 2011-06-28 16:55 ` burnus at gcc dot gnu.org
  2012-04-16 22:04 ` burnus at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-06-28 16:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-06-28 16:55:16 UTC ---
(In reply to comment #2)
>   /* 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);

It's too warm to think poperly: TREE_CODE (type) is ARRAY_TYPE but
TREE_CODE(TREE_TYPE(type)) is INTEGER_TYPE - not an ARRAY_TYPE; hence the code
is never executed. Nevertheless, the issue is presumably related to type having
TYPE_STRING_FLAG set, but TREE_TYPE(type) having it not.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug fortran/49565] character(kind=4) is emitted as DW_ATE_unsigned, not DW_ATE_unsigned_char
  2011-06-28 15:55 [Bug fortran/49565] New: character(kind=4) is emitted as DW_ATE_unsigned, not DW_ATE_unsigned_char tromey at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2011-06-28 16:55 ` burnus at gcc dot gnu.org
@ 2012-04-16 22:04 ` burnus at gcc dot gnu.org
  2013-03-15 17:50 ` burnus at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-04-16 22:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-04-16 22:04:20 UTC ---
See also http://www.dwarfstd.org/ShowIssue.php?issue=120213.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug fortran/49565] character(kind=4) is emitted as DW_ATE_unsigned, not DW_ATE_unsigned_char
  2011-06-28 15:55 [Bug fortran/49565] New: character(kind=4) is emitted as DW_ATE_unsigned, not DW_ATE_unsigned_char tromey at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2012-04-16 22:04 ` burnus at gcc dot gnu.org
@ 2013-03-15 17:50 ` burnus at gcc dot gnu.org
  2015-10-20 21:54 ` dominiq at lps dot ens.fr
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-03-15 17:50 UTC (permalink / raw)
  To: gcc-bugs


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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu.org

--- Comment #5 from Tobias Burnus <burnus at gcc dot gnu.org> 2013-03-15 17:49:35 UTC ---
Now moved to http://www.dwarfstd.org/ShowIssue.php?issue=121221.1&type=closed

Note: It is listed under "resolved issues".


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug fortran/49565] character(kind=4) is emitted as DW_ATE_unsigned, not DW_ATE_unsigned_char
  2011-06-28 15:55 [Bug fortran/49565] New: character(kind=4) is emitted as DW_ATE_unsigned, not DW_ATE_unsigned_char tromey at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2013-03-15 17:50 ` burnus at gcc dot gnu.org
@ 2015-10-20 21:54 ` dominiq at lps dot ens.fr
  2024-03-20 21:54 ` anlauf at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: dominiq at lps dot ens.fr @ 2015-10-20 21:54 UTC (permalink / raw)
  To: gcc-bugs

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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2015-10-20
                 CC|                            |jakub at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #6 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> Now moved to http://www.dwarfstd.org/ShowIssue.php?issue=121221.1&type=closed
>
> Note: It is listed under "resolved issues".

Any progress after two years and a half?


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug fortran/49565] character(kind=4) is emitted as DW_ATE_unsigned, not DW_ATE_unsigned_char
  2011-06-28 15:55 [Bug fortran/49565] New: character(kind=4) is emitted as DW_ATE_unsigned, not DW_ATE_unsigned_char tromey at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2015-10-20 21:54 ` dominiq at lps dot ens.fr
@ 2024-03-20 21:54 ` anlauf at gcc dot gnu.org
  2024-03-21  2:57 ` tromey at gcc dot gnu.org
  2024-03-21 18:35 ` anlauf at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: anlauf at gcc dot gnu.org @ 2024-03-20 21:54 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|---                         |FIXED

--- Comment #12 from anlauf at gcc dot gnu.org ---
After reading this ancient thread, I don't see anything left to do.  Closing.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug fortran/49565] character(kind=4) is emitted as DW_ATE_unsigned, not DW_ATE_unsigned_char
  2011-06-28 15:55 [Bug fortran/49565] New: character(kind=4) is emitted as DW_ATE_unsigned, not DW_ATE_unsigned_char tromey at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2024-03-20 21:54 ` anlauf at gcc dot gnu.org
@ 2024-03-21  2:57 ` tromey at gcc dot gnu.org
  2024-03-21 18:35 ` anlauf at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: tromey at gcc dot gnu.org @ 2024-03-21  2:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #13 from Tom Tromey <tromey at gcc dot gnu.org> ---
(In reply to anlauf from comment #12)
> After reading this ancient thread, I don't see anything left to do.  Closing.

GCC still emits

 <1><d5>: Abbrev Number: 1 (DW_TAG_base_type)
    <d6>   DW_AT_byte_size   : 4
    <d7>   DW_AT_encoding    : 7        (unsigned)
    <d8>   DW_AT_name        : (indirect string, offset: 0x43):
character(kind=4)


i.e., DW_ATE_unsigned.
That still seems incorrect to me, so I think this should be reopened.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug fortran/49565] character(kind=4) is emitted as DW_ATE_unsigned, not DW_ATE_unsigned_char
  2011-06-28 15:55 [Bug fortran/49565] New: character(kind=4) is emitted as DW_ATE_unsigned, not DW_ATE_unsigned_char tromey at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2024-03-21  2:57 ` tromey at gcc dot gnu.org
@ 2024-03-21 18:35 ` anlauf at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: anlauf at gcc dot gnu.org @ 2024-03-21 18:35 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |WAITING
         Resolution|FIXED                       |---

--- Comment #14 from anlauf at gcc dot gnu.org ---
OK, reopening.

The link in comment#5 currently has the status "Accepted" for dwarf-5:

https://dwarfstd.org/issues/121221.1.html

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2024-03-21 18:35 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-28 15:55 [Bug fortran/49565] New: character(kind=4) is emitted as DW_ATE_unsigned, not DW_ATE_unsigned_char tromey at gcc dot gnu.org
2011-06-28 16:08 ` [Bug fortran/49565] " burnus at gcc dot gnu.org
2011-06-28 16:45 ` burnus at gcc dot gnu.org
2011-06-28 16:55 ` burnus at gcc dot gnu.org
2012-04-16 22:04 ` burnus at gcc dot gnu.org
2013-03-15 17:50 ` burnus at gcc dot gnu.org
2015-10-20 21:54 ` dominiq at lps dot ens.fr
2024-03-20 21:54 ` anlauf at gcc dot gnu.org
2024-03-21  2:57 ` tromey at gcc dot gnu.org
2024-03-21 18:35 ` anlauf at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).