From: Eric Botcazou <[email protected]>

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.

Tested on x86_64-pc-linux-gnu (before the recent bootstrap breakage), committed 
on master.

---
 gcc/ada/exp_ch4.adb | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb
index 3c5c9266438..f5f03bac57b 100644
--- a/gcc/ada/exp_ch4.adb
+++ b/gcc/ada/exp_ch4.adb
@@ -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;
-- 
2.51.0

Reply via email to