utils2.c (build_allocator): In type_annotate_only mode return NULL_EXPR.
authorEric Botcazou <ebotcazou@adacore.com>
Sat, 9 Sep 2017 12:36:20 +0000 (12:36 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Sat, 9 Sep 2017 12:36:20 +0000 (12:36 +0000)
* gcc-interface/utils2.c (build_allocator): In type_annotate_only mode
return NULL_EXPR.

From-SVN: r251933

gcc/ada/ChangeLog
gcc/ada/gcc-interface/utils2.c

index d0d230c167a9946472e5483c3ccd8daa5090a27a..efef4f7d0a1d6b58f117269d38f39bb5cafb2112 100644 (file)
@@ -1,3 +1,8 @@
+2017-09-09  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gcc-interface/utils2.c (build_allocator): In type_annotate_only mode
+       return NULL_EXPR.
+
 2017-09-09  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gcc-interface/decl.c (promote_object_alignment): New function taken
index 543b5398941d3ba53a7aaf40836ad1045ec4468a..072e1052c16bffe5193a9f1c1a601c0a3e520561 100644 (file)
@@ -2350,6 +2350,12 @@ build_allocator (tree type, tree init, tree result_type, Entity_Id gnat_proc,
   if (init && TREE_CODE (init) == NULL_EXPR)
     return build1 (NULL_EXPR, result_type, TREE_OPERAND (init, 0));
 
+  /* If we are just annotating types, also return a NULL_EXPR.  */
+  else if (type_annotate_only)
+    return build1 (NULL_EXPR, result_type,
+                  build_call_raise (CE_Range_Check_Failed, gnat_node,
+                                    N_Raise_Constraint_Error));
+
   /* If the initializer, if present, is a COND_EXPR, deal with each branch.  */
   else if (init && TREE_CODE (init) == COND_EXPR)
     return build3 (COND_EXPR, result_type, TREE_OPERAND (init, 0),