public inbox for gdb-testers@sourceware.org
help / color / mirror / Atom feed
From: sergiodj+buildbot@sergiodj.net
To: gdb-testers@sourceware.org
Subject: [binutils-gdb] (Ada) Fix Length attribute on array access
Date: Fri, 05 Jan 2018 11:59:00 -0000	[thread overview]
Message-ID: <7150d33cda60fd543e9d9d68eb58d4e6155fb878@gdb-build> (raw)

*** TEST RESULTS FOR COMMIT 7150d33cda60fd543e9d9d68eb58d4e6155fb878 ***

Author: Jerome Guitton <guitton@adacore.com>
Branch: master
Commit: 7150d33cda60fd543e9d9d68eb58d4e6155fb878

(Ada) Fix Length attribute on array access

Consider the following variable "Indexed_By_Enum", declared as
an access to an array whose index type is an enumerated type
whose underlying values have "gaps":

   type Enum_With_Gaps is (LIT0, LIT1, LIT2, LIT3, LIT4);
   for Enum_With_Gaps use (LIT0 => 3,
                           LIT1 => 5,
                           LIT2 => 8,
                           LIT3 => 13,
                           LIT4 => 21);
   for Enum_With_Gaps'size use 16;

   type MyWord is range 0 .. 16#FFFF# ;
   for MyWord'Size use 16;

   type AR is array (Enum_With_Gaps range <>) of MyWord;
   type AR_Access is access AR;

   Indexed_By_Enum : AR_Access :=
     new AR'(LIT1 => 1,  LIT2 => 43, LIT3 => 42, LIT4 => 41);

Trying to print the length (number of elements) of this array using
the 'Length attribute does not work:

    (gdb) print indexed_by_enum'length
    'POS only defined on discrete types

The problem occurs while trying to get the array's index type.
It was using TYPE_INDEX_TYPE for that. It does not work for Ada arrays
in general; use ada_index_type instead.

gdb/ChangeLog:

	* ada-lang.c (ada_array_length): Use ada_index_type instead of
	TYPE_INDEX_TYPE.

gdb/testsuite/ChangeLog:

        * gdb.ada/arr_acc_idx_w_gap: New testcase.

Tested on x86_64-linux.


             reply	other threads:[~2018-01-05 11:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-05 11:59 sergiodj+buildbot [this message]
2018-01-05 11:59 ` Failures on Ubuntu-AArch64-native-gdbserver-m64, branch master sergiodj+buildbot
2018-01-05 12:42 ` Failures on Fedora-x86_64-native-gdbserver-m32, " sergiodj+buildbot
2018-01-05 12:47 ` Failures on Fedora-i686, " sergiodj+buildbot
2018-01-05 13:08 ` Failures on Fedora-x86_64-m64, " sergiodj+buildbot
2018-01-05 13:08 ` Failures on Fedora-x86_64-native-extended-gdbserver-m32, " sergiodj+buildbot
2018-01-05 14:30 ` Failures on Fedora-x86_64-cc-with-index, " sergiodj+buildbot
2018-01-05 16:33 ` Failures on Ubuntu-AArch32-native-extended-gdbserver-m32, " sergiodj+buildbot
2018-01-05 17:27 ` Failures on Ubuntu-AArch32-native-gdbserver-m32, " sergiodj+buildbot
2018-01-05 18:18 ` Failures on Ubuntu-AArch32-m32, " sergiodj+buildbot

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=7150d33cda60fd543e9d9d68eb58d4e6155fb878@gdb-build \
    --to=sergiodj+buildbot@sergiodj.net \
    --cc=gdb-testers@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).