]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Fix small oversight in accessibility change
authorEric Botcazou <ebotcazou@adacore.com>
Mon, 22 Dec 2025 09:52:01 +0000 (10:52 +0100)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Fri, 9 Jan 2026 10:57:22 +0000 (11:57 +0100)
The change incorrectly turned a Comes_From_Source test initially done on the
type conversion node, into a test on its parent node, that is used to decide
whether to apply an accessibility check to the type conversion.

gcc/ada/ChangeLog:

* exp_ch4.adb (Expand_N_Type_Conversion): Restore Comes_From_Source
test on N itself instead of its parent node.

gcc/ada/exp_ch4.adb

index 3c5c92664382b23e9a53e5d0a3c5b1393662751d..f5f03bac57bd5931a03d6d65d278ec3fd92f7761 100644 (file)
@@ -12364,10 +12364,10 @@ package body Exp_Ch4 is
                       or else Attribute_Name (Original_Node (N)) = Name_Access)
            and then not No_Dynamic_Accessibility_Checks_Enabled (N)
          then
-            if Nkind (Parent (N)) in N_Function_Call
-                                   | N_Parameter_Association
-                                   | N_Procedure_Call_Statement
-              and then not Comes_From_Source (Parent (N))
+            if not Comes_From_Source (N)
+              and then Nkind (Parent (N)) in N_Function_Call
+                                           | N_Parameter_Association
+                                           | N_Procedure_Call_Statement
               and then Is_Tagged_Type (Designated_Type (Target_Type))
             then
                null;