public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/101643] New: [debug, ada] packed array not described as packed
@ 2021-07-27 14:15 vries at gcc dot gnu.org
  2021-07-27 14:17 ` [Bug debug/101643] " vries at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: vries at gcc dot gnu.org @ 2021-07-27 14:15 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 101643
           Summary: [debug, ada] packed array not described as packed
           Product: gcc
           Version: 7.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

[ Filing FTR. ]

Consider gdb test-case foo_ra24_010.adb / pck.adb / pck.ads (
https://sourceware.org/git/?p=binutils-gdb.git;a=tree;f=gdb/testsuite/gdb.ada/big_packed_array
).

With gcc-8.5.0 we have:
...
$ gnatmake-8 -f foo_ra24_010.adb -fgnat-encodings=minimal -g
$ gdb -q -batch ./foo_ra24_010 -ex start -ex n -ex n -ex 'p bad'
Temporary breakpoint 1 at 0x402ce6: file foo_ra24_010.adb, line 19.

Temporary breakpoint 1, foo_ra24_010 () at foo_ra24_010.adb:19
19         Good : PA := (others => False);
20         Bad : Bad_Packed_Table := (others => False);
22         Do_Nothing (Good'Address);  -- STOP
$1 = (0 => 0 <repeats 25 times>)
...
while with gcc-9.3.1 we have:
...
$ gnatmake-9 -f foo_ra24_010.adb -fgnat-encodings=minimal -g
+ gdb -q -batch ./foo_ra24_010 -ex start -ex n -ex n -ex 'p bad'
Temporary breakpoint 1 at 0x402d24: file foo_ra24_010.adb, line 19.

Temporary breakpoint 1, foo_ra24_010 () at foo_ra24_010.adb:19
19         Good : PA := (others => False);
20         Bad : Bad_Packed_Table := (others => False);
22         Do_Nothing (Good'Address);  -- STOP
$1 = (false <repeats 196 times>)
...

The difference in gdb behaviour is caused by the dwarf information.

With gcc-8.5.0 we have:
...
 <2><2074>: Abbrev Number: 10 (DW_TAG_variable)
    <2075>   DW_AT_name        : bad
    <207c>   DW_AT_type        : <0x2028>
 <1><2028>: Abbrev Number: 5 (DW_TAG_array_type)
    <2029>   DW_AT_name        : pck__t
    <202d>   DW_AT_bit_stride  : 8
    <202e>   DW_AT_type        : <0x2003>
    <2032>   DW_AT_alignment   : 1
    <2033>   DW_AT_sibling     : <0x203f>
 <2><2037>: Abbrev Number: 7 (DW_TAG_subrange_type)
    <2038>   DW_AT_type        : <0x200a>
    <203c>   DW_AT_lower_bound : 0
    <203d>   DW_AT_upper_bound : 24
 <2><203e>: Abbrev Number: 0
 <1><2003>: Abbrev Number: 4 (DW_TAG_base_type)
    <2004>   DW_AT_byte_size   : 1
    <2005>   DW_AT_encoding    : 7      (unsigned)
    <2006>   DW_AT_name        : system__unsigned_types__packed_byte
 <1><200a>: Abbrev Number: 4 (DW_TAG_base_type)
    <200b>   DW_AT_byte_size   : 4
    <200c>   DW_AT_encoding    : 5      (signed)
    <200d>   DW_AT_name        : integer
...

With gcc-9.3.1 we have for foo_ra24_010.adb:
...
 <2><20a1>: Abbrev Number: 11 (DW_TAG_variable)
    <20a2>   DW_AT_name        : bad
    <20a9>   DW_AT_type        : <0x205f>
 <1><205f>: Abbrev Number: 7 (DW_TAG_typedef)
    <2060>   DW_AT_name        : pck__bad_packed_table
    <2067>   DW_AT_type        : <0x2048>
    <206b>   DW_AT_alignment   : 1
 <1><2048>: Abbrev Number: 5 (DW_TAG_array_type)
    <2049>   DW_AT_name        : pck__t___XP1
    <204d>   DW_AT_bit_stride  : 8
    <204e>   DW_AT_type        : <0x2016>
    <2052>   DW_AT_alignment   : 1
 <2><2057>: Abbrev Number: 8 (DW_TAG_subrange_type)
    <2058>   DW_AT_type        : <0x201d>
    <205c>   DW_AT_lower_bound : 0
    <205d>   DW_AT_upper_bound : 24
 <2><205e>: Abbrev Number: 0
 <1><2016>: Abbrev Number: 4 (DW_TAG_base_type)
    <2017>   DW_AT_byte_size   : 1
    <2018>   DW_AT_encoding    : 7      (unsigned)
    <2019>   DW_AT_name        : system__unsigned_types__packed_byte
 <1><201d>: Abbrev Number: 4 (DW_TAG_base_type)
    <201e>   DW_AT_byte_size   : 4
    <201f>   DW_AT_encoding    : 5      (signed)
    <2020>   DW_AT_name        : integer
...
and with pck__t___XP1 listed once more for pck.adb as:
...
 <1><1ab5>: Abbrev Number: 5 (DW_TAG_array_type)
    <1ab6>   DW_AT_name        : pck__t___XP1
    <1aba>   DW_AT_bit_stride  : 1
    <1abb>   DW_AT_type        : <0x1aa0>
    <1abf>   DW_AT_alignment   : 1
 <2><1ac4>: Abbrev Number: 6 (DW_TAG_subrange_type)
    <1ac5>   DW_AT_type        : <0x15f9>
    <1ac9>   DW_AT_lower_bound : 0
    <1aca>   DW_AT_upper_bound : 195
 <2><1acb>: Abbrev Number: 0
 <1><1aa0>: Abbrev Number: 4 (DW_TAG_base_type)
    <1aa1>   DW_AT_byte_size   : 1
    <1aa2>   DW_AT_encoding    : 2      (boolean)
    <1aa3>   DW_AT_name        : boolean
 <1><15f9>: Abbrev Number: 2 (DW_TAG_enumeration_type)
    <15fa>   DW_AT_name        : pck__enum_idx
    <15fe>   DW_AT_encoding    : 7      (unsigned)
    <15ff>   DW_AT_byte_size   : 1
...

ISTM that in the gcc-8.5.0 case, gdb does the best it can do with the info
provided, and that is this a gcc bug.

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

* [Bug debug/101643] [debug, ada] packed array not described as packed
  2021-07-27 14:15 [Bug debug/101643] New: [debug, ada] packed array not described as packed vries at gcc dot gnu.org
@ 2021-07-27 14:17 ` vries at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: vries at gcc dot gnu.org @ 2021-07-27 14:17 UTC (permalink / raw)
  To: gcc-bugs

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

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
           Keywords|                            |wrong-debug
             Status|UNCONFIRMED                 |RESOLVED
   Target Milestone|---                         |9.0
            Version|7.5.0                       |8.5.0

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
Fixed by:
...
commit 21afc4facd1ac4f62f7bd8ca0a3997fdb8ed1230
Author:     Eric Botcazou <ebotcazou@adacore.com>
AuthorDate: Thu May 31 10:46:02 2018 +0000
Commit:     Pierre-Marie de Rodat <pmderodat@gcc.gnu.org>
CommitDate: Thu May 31 10:46:02 2018 +0000

    [Ada] Fix strange behavior of Object_Size for packed array subtype

    2018-05-31  Eric Botcazou  <ebotcazou@adacore.com>

    gcc/ada/

            * gcc-interface/decl.c (gnat_to_gnu_entity) <discrete_type>: Do not
            deal with the ___XP suffix for packed array types here...
            <E_Array_Subtype>: ...or here when processing the implementation
type
            but when processing the original type instead.  Do not reuse the
DECL
            of the implementation type for the original type.  Tidy up.

    From-SVN: r260999
...

I was not able to find a submission of this patch.

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

end of thread, other threads:[~2021-07-27 14:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-27 14:15 [Bug debug/101643] New: [debug, ada] packed array not described as packed vries at gcc dot gnu.org
2021-07-27 14:17 ` [Bug debug/101643] " vries 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).