Detect illegal conditions in Raise_xxx_Error nodes
authorPiotr Trojanek <trojanek@adacore.com>
Fri, 21 May 2021 09:30:26 +0000 (11:30 +0200)
committerEric Botcazou <ebotcazou@adacore.com>
Fri, 21 May 2021 09:31:46 +0000 (11:31 +0200)
Enforce comment from sinfo.ads about the Condition field in N_Raise_xxx_Error
nodes. Only an extra sanity check; the behaviour is not affected.

gcc/ada/
* gcc-interface/trans.c (Raise_Error_to_gnu): Add an assertion.

gcc/ada/gcc-interface/trans.c

index 289a2ef..ee014a3 100644 (file)
@@ -6159,7 +6159,12 @@ Raise_Error_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p)
        }
     }
   else
-    gnu_result = build1 (NULL_EXPR, *gnu_result_type_p, gnu_result);
+    {
+      /* The condition field must not be present when the node is used as an
+        expression form.  */
+      gigi_checking_assert (No (gnat_cond));
+      gnu_result = build1 (NULL_EXPR, *gnu_result_type_p, gnu_result);
+    }
 
   return gnu_result;
 }