[Ada] Compiler crash on prefixed call to controlled function with invariant check
authorGary Dismukes <dismukes@adacore.com>
Wed, 5 Aug 2020 20:29:30 +0000 (16:29 -0400)
committerPierre-Marie de Rodat <derodat@adacore.com>
Wed, 21 Oct 2020 07:22:46 +0000 (03:22 -0400)
gcc/ada/

* exp_ch6.adb (Insert_Post_Call_Actions): Test for
N_Explicit_Dereference as part of the existing test for function
calls.

gcc/ada/exp_ch6.adb

index 7b50812..b04d1c0 100644 (file)
@@ -8360,9 +8360,12 @@ package body Exp_Ch6 is
          --  The write-back of (in)-out parameters is handled by the back-end,
          --  but the constraint checks generated when subtypes of formal and
          --  actual don't match must be inserted in the form of assignments.
+         --  Also do this in the case of explicit dereferences, which can occur
+         --  due to rewritings of function calls with controlled results.
 
          if Nkind (N) = N_Function_Call
            or else Nkind (Original_Node (N)) = N_Function_Call
+           or else Nkind (N) = N_Explicit_Dereference
          then
             pragma Assert (Ada_Version >= Ada_2012);
             --  Functions with '[in] out' parameters are only allowed in Ada