]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Preserve local variables in another Ada test case
authorTom Tromey <tromey@adacore.com>
Tue, 21 Jan 2025 15:19:21 +0000 (08:19 -0700)
committerTom Tromey <tromey@adacore.com>
Wed, 22 Jan 2025 15:05:11 +0000 (08:05 -0700)
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
gdb/testsuite/gdb.ada/local-enum/pck.adb [new file with mode: 0644]
gdb/testsuite/gdb.ada/local-enum/pck.ads [new file with mode: 0644]

index d4c1b65665b38498a009840c73fce93dac9e673d..29e8ebdc4d6b3cf9458504efeba310415f9bc230 100644 (file)
@@ -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 (file)
index 0000000..a175b7b
--- /dev/null
@@ -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 (file)
index 0000000..384bf08
--- /dev/null
@@ -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;