From d27ec3f60a3ac5eab05765cbbf45083e4e3dabc6 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Sat, 11 Apr 2020 18:28:49 +0200 Subject: [PATCH] [Ada] Work around problematic interaction with public symbol generation 2020-06-17 Eric Botcazou gcc/ada/ * exp_attr.adb (Expand_N_Attribute_Reference) : Do not replace the bound for an array type if it is public. --- gcc/ada/exp_attr.adb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gcc/ada/exp_attr.adb b/gcc/ada/exp_attr.adb index 51cda8299ec..ea36be02100 100644 --- a/gcc/ada/exp_attr.adb +++ b/gcc/ada/exp_attr.adb @@ -3424,7 +3424,14 @@ package body Exp_Attr is -- reference. Note that this must be in keeping with what is done -- for scalar types in order for range checks to be elided in loops. - elsif Is_Array_Type (Ptyp) and then Is_Constrained (Ptyp) then + -- However, avoid doing it if the array type is public because, in + -- this case, we effectively rely on the back end to create public + -- symbols with consistent names across units for the array bounds. + + elsif Is_Array_Type (Ptyp) + and then Is_Constrained (Ptyp) + and then not Is_Public (Ptyp) + then declare Bnd : Node_Id; -- 2.30.2