diff options
author | Tom Tromey <tromey@adacore.com> | 2025-01-21 08:19:21 -0700 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2025-01-22 08:05:11 -0700 |
commit | 63efd116baafd6210a65b29973766c3fa264098f (patch) | |
tree | 79325edee8d03b23e3f268ea63dd129de28a6525 | |
parent | 95db53e5a03dacef594430f28281748f3111c1f6 (diff) | |
download | binutils-63efd116baafd6210a65b29973766c3fa264098f.zip binutils-63efd116baafd6210a65b29973766c3fa264098f.tar.gz binutils-63efd116baafd6210a65b29973766c3fa264098f.tar.bz2 |
Preserve local variables in another Ada test case
I found another Ada test case where gnat-llvm optimizes away the local
variables. This patch applies the same fix to it as previous patches.
-rw-r--r-- | gdb/testsuite/gdb.ada/local-enum/local.adb | 7 | ||||
-rw-r--r-- | gdb/testsuite/gdb.ada/local-enum/pck.adb | 21 | ||||
-rw-r--r-- | gdb/testsuite/gdb.ada/local-enum/pck.ads | 19 |
3 files changed, 45 insertions, 2 deletions
diff --git a/gdb/testsuite/gdb.ada/local-enum/local.adb b/gdb/testsuite/gdb.ada/local-enum/local.adb index d4c1b65..29e8ebd 100644 --- a/gdb/testsuite/gdb.ada/local-enum/local.adb +++ b/gdb/testsuite/gdb.ada/local-enum/local.adb @@ -1,4 +1,4 @@ --- Copyright 2021-2024 Free Software Foundation, Inc. +-- Copyright 2021-2025 Free Software Foundation, Inc. -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by @@ -13,6 +13,8 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. +with Pck; use Pck; + procedure Local is type E1 is (one, two, three); type E2 is (three, four, five); @@ -24,5 +26,6 @@ procedure Local is V2 : A2 := (3, 4, 5); begin - null; -- STOP + Do_Nothing (V1'Address); -- STOP + Do_Nothing (V2'Address); end Local; diff --git a/gdb/testsuite/gdb.ada/local-enum/pck.adb b/gdb/testsuite/gdb.ada/local-enum/pck.adb new file mode 100644 index 0000000..a175b7b --- /dev/null +++ b/gdb/testsuite/gdb.ada/local-enum/pck.adb @@ -0,0 +1,21 @@ +-- Copyright 2014-2024 Free Software Foundation, Inc. +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see <http://www.gnu.org/licenses/>. + +package body Pck is + procedure Do_Nothing (A : System.Address) is + begin + null; + end Do_Nothing; +end Pck; diff --git a/gdb/testsuite/gdb.ada/local-enum/pck.ads b/gdb/testsuite/gdb.ada/local-enum/pck.ads new file mode 100644 index 0000000..384bf08 --- /dev/null +++ b/gdb/testsuite/gdb.ada/local-enum/pck.ads @@ -0,0 +1,19 @@ +-- Copyright 2014-2024 Free Software Foundation, Inc. +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see <http://www.gnu.org/licenses/>. + +with System; +package Pck is + procedure Do_Nothing (A : System.Address); +end Pck; |