Fix var_arr_typedef.exp to preserve local variable

This patch fixes var_arr_typedef.exp to preserve a local variable a
bit better, protecting it from a gnat-llvm optimization.
This commit is contained in:
Tom Tromey
2025-09-10 09:59:18 -06:00
parent 86aa0d170d
commit 2fe19b88c9
3 changed files with 5 additions and 3 deletions

View File

@@ -20,6 +20,6 @@ package body Pack is
return I; return I;
end Identity; end Identity;
procedure Do_Nothing (A : Array_Type) is null; procedure Do_Nothing (A : System.Address) is null;
end Pack; end Pack;

View File

@@ -13,6 +13,8 @@
-- You should have received a copy of the GNU General Public License -- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>. -- along with this program. If not, see <http://www.gnu.org/licenses/>.
with System; use System;
package Pack is package Pack is
type Rec_Type is record type Rec_Type is record
I : Integer; I : Integer;
@@ -23,7 +25,7 @@ package Pack is
type Array_Type is array (Positive range <>) of Vec_Type; type Array_Type is array (Positive range <>) of Vec_Type;
procedure Do_Nothing (A : Array_Type); procedure Do_Nothing (A : System.Address);
function Identity (I : Integer) return Integer; function Identity (I : Integer) return Integer;
end Pack; end Pack;

View File

@@ -24,5 +24,5 @@ procedure Var_Arr_Typedef is
A : constant Array_Type (1 .. Identity (4)) := (VA, VA, VB, VB); A : constant Array_Type (1 .. Identity (4)) := (VA, VA, VB, VB);
begin begin
Do_Nothing (A); -- BREAK Do_Nothing (A'Address); -- BREAK
end Var_Arr_Typedef; end Var_Arr_Typedef;