[binutils-gdb] Fix one test case for gnat-llvm
Tom Tromey via Gdb-cvs <[email protected]>
| Newsgroups | gmane.comp.gdb.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=97d3d451522bb9e7e0f80c68c4c1acab21499e98 commit 97d3d451522bb9e7e0f80c68c4c1acab21499e98 Author: Tom Tromey <[email protected]> Date: Wed Apr 29 13:41:35 2026 -0600 Fix one test case for gnat-llvm 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. Diff: --- 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;