[pushed] Preserve local variables in another Ada test case
Checks
Commit Message
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.
---
gdb/testsuite/gdb.ada/local-enum/local.adb | 7 +++++--
gdb/testsuite/gdb.ada/local-enum/pck.adb | 21 +++++++++++++++++++++
gdb/testsuite/gdb.ada/local-enum/pck.ads | 19 +++++++++++++++++++
3 files changed, 45 insertions(+), 2 deletions(-)
create mode 100644 gdb/testsuite/gdb.ada/local-enum/pck.adb
create mode 100644 gdb/testsuite/gdb.ada/local-enum/pck.ads
@@ -1,4 +1,4 @@
+-- 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;
new file mode 100644
@@ -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;
new file mode 100644
@@ -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;