From: Tom Tromey <tromey@adacore.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@adacore.com>
Subject: [pushed] Fix one test case for gnat-llvm
Date: Thu, 30 Apr 2026 07:46:11 -0600 [thread overview]
Message-ID: <20260430134611.2496548-1-tromey@adacore.com> (raw)
LLVM is a bit eager about removing unused locals. Investigating this
test case showed that the problem was that some array bounds, which
are stored in artificial locals, are not emitted.
Since this isn't really germane to the test, and because real code
doesn't normally do this kind of thing, I think it's best to simply
update the test to preserve the bounds.
As this patch is Ada-specific, I am checking it in.
---
gdb/testsuite/gdb.ada/enum_idx_packed/foo.adb | 27 +++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/gdb/testsuite/gdb.ada/enum_idx_packed/foo.adb b/gdb/testsuite/gdb.ada/enum_idx_packed/foo.adb
index 27e2e7257d5..48509b75730 100644
--- a/gdb/testsuite/gdb.ada/enum_idx_packed/foo.adb
+++ b/gdb/testsuite/gdb.ada/enum_idx_packed/foo.adb
@@ -30,12 +30,39 @@ procedure Foo is
Green => (5, 6, 7),
others => (others => 72));
+ -- These variables ensure the bounds aren't elided by LLVM.
+ Small_First : Color := Small'First;
+ Small_Last : Color := Small'Last;
+ Multi_First1 : Color := Multi'First (1);
+ Multi_Last1 : Color := Multi'Last (1);
+ Multi_First2 : Strength := Multi'First (2);
+ Multi_Last2 : Strength := Multi'Last (2);
+
+ MM_First1 : Positive := Multi_Multi'First (1);
+ MM_Last1 : Positive := Multi_Multi'Last (1);
+ MM_First2 : Positive := Multi_Multi'First (2);
+ MM_Last2 : Positive := Multi_Multi'Last (2);
+ MM_First3 : Positive := Multi_Multi'First (3);
+ MM_Last3 : Positive := Multi_Multi'Last (3);
+
begin
Do_Nothing (Full'Address); -- STOP
Do_Nothing (Primary'Address);
Do_Nothing (Cold'Address);
Do_Nothing (Small'Address);
+ Do_Nothing (Small_First'Address);
+ Do_Nothing (Small_Last'Address);
Do_Nothing (Multi'Address);
+ Do_Nothing (Multi_First1'Address);
+ Do_Nothing (Multi_Last1'Address);
+ Do_Nothing (Multi_First2'Address);
+ Do_Nothing (Multi_Last2'Address);
Do_Nothing (Multi_Multi'Address);
Do_Nothing (Multi_Access'Address);
+ Do_Nothing (MM_First1'Address);
+ Do_Nothing (MM_Last1'Address);
+ Do_Nothing (MM_First2'Address);
+ Do_Nothing (MM_Last2'Address);
+ Do_Nothing (MM_First3'Address);
+ Do_Nothing (MM_Last3'Address);
end Foo;
base-commit: bc145a24033381e93bae0ee24add664386c66433
--
2.53.0
reply other threads:[~2026-04-30 13:47 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260430134611.2496548-1-tromey@adacore.com \
--to=tromey@adacore.com \
--cc=gdb-patches@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