* [pushed] Fix one test case for gnat-llvm
@ 2026-04-30 13:46 Tom Tromey
0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2026-04-30 13:46 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-04-30 13:47 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-04-30 13:46 [pushed] Fix one test case for gnat-llvm Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox