public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "gdb.bugs at mfriebe dot de" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/15102] New: dwarf/regression: array index treated as signed byte, when specified unsigned byte (leads to [0..-n])
Date: Tue, 05 Feb 2013 19:17:00 -0000	[thread overview]
Message-ID: <bug-15102-4717@http.sourceware.org/bugzilla/> (raw)

http://sourceware.org/bugzilla/show_bug.cgi?id=15102

             Bug #: 15102
           Summary: dwarf/regression: array index treated as signed byte,
                    when specified unsigned byte (leads to [0..-n])
           Product: gdb
           Version: 7.5
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
        AssignedTo: unassigned@sourceware.org
        ReportedBy: gdb.bugs@mfriebe.de
    Classification: Unclassified


This issue is present in GDB 7.3, gdb 7.4, gdb 7.5
It was not present in 7.2

Compile using free-pascal (-gw creates dwarf 2)
   fpc.exe -gw Array.pas

program Foo;
type TByteArray = array[0..191] of integer;
var a: TByteArray;
begin
  a[1] := 0;
end.

execute in gdb:
  ptype TByteArray

type = array [0..-65] of SMALLINT

But it should be 0..191

OBJDUMP -w shows

 <2><95>: Abbrev Number: 6 (DW_TAG_subrange_type)
    <96>   DW_AT_lower_bound : 0
    <97>   DW_AT_upper_bound : 191
    <99>   DW_AT_stride      : 2
    <9a>   DW_AT_type        : <0xc3>

 <1><c3>: Abbrev Number: 4 (DW_TAG_typedef)
    <c4>   DW_AT_name        : BYTE
    <c9>   DW_AT_type        : <0xcd>
 <1><cd>: Abbrev Number: 8 (DW_TAG_base_type)
    <ce>   DW_AT_name        : BYTE
    <d3>   DW_AT_encoding    : 7        (unsigned)
    <d4>   DW_AT_byte_size   : 1


The basetype is clearly marked unsigned.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


             reply	other threads:[~2013-02-05 19:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-05 19:17 gdb.bugs at mfriebe dot de [this message]
2013-02-06 12:53 ` [Bug gdb/15102] " tromey at redhat dot com
2013-02-18 21:04 ` cvs-commit at gcc dot gnu.org
2013-02-18 21:06 ` tromey at redhat dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-15102-4717@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).