trans.c (Call_to_gnu): Remove guard for NULL_EXPR.
authorEric Botcazou <ebotcazou@adacore.com>
Thu, 10 Dec 2015 14:06:15 +0000 (14:06 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Thu, 10 Dec 2015 14:06:15 +0000 (14:06 +0000)
* gcc-interface/trans.c (Call_to_gnu): Remove guard for NULL_EXPR.
* gcc-interface/utils2.c (gnat_rewrite_reference) <ERROR_MARK>: Return
the reference unmodified.
<NULL_EXPR>: New case.  Likewise.

From-SVN: r231513

gcc/ada/ChangeLog
gcc/ada/gcc-interface/trans.c
gcc/ada/gcc-interface/utils2.c
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/array25.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/array25_pkg.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/array25_pkg.ads [new file with mode: 0644]

index 955f036ce0d3d1fd1f19ad0633952b87291d46b7..10758ff1cb5045c1a3e51069e13c7b4c4c11e083 100644 (file)
@@ -1,3 +1,10 @@
+2015-12-10  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gcc-interface/trans.c (Call_to_gnu): Remove guard for NULL_EXPR.
+       * gcc-interface/utils2.c (gnat_rewrite_reference) <ERROR_MARK>: Return
+       the reference unmodified.
+       <NULL_EXPR>: New case.  Likewise.
+
 2015-12-10  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gcc-interface/gigi.h (create_var_decl): Adjust comment.
index d565854a94ddbd7271ff3572bf98c3b0746a2ca8..d8d5ce20c969d92cf2740d1ce5c85778db4a2c82 100644 (file)
@@ -4407,9 +4407,7 @@ Call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target,
       /* If it's possible we may need to use this expression twice, make sure
         that any side-effects are handled via SAVE_EXPRs; likewise if we need
         to force side-effects before the call.  */
-      if (Ekind (gnat_formal) != E_In_Parameter
-         && !is_by_ref_formal_parm
-         && TREE_CODE (gnu_name) != NULL_EXPR)
+      if (Ekind (gnat_formal) != E_In_Parameter && !is_by_ref_formal_parm)
        {
          tree init = NULL_TREE;
          gnu_name = gnat_stabilize_reference (gnu_name, true, &init);
index ca307f36b4b0abab3ddc53fbc767153d8ab52ce2..8af121e73978cca19cb230a43cd134864b889c04 100644 (file)
@@ -2733,7 +2733,8 @@ gnat_rewrite_reference (tree ref, rewrite_fn func, void *data, tree *init)
       break;
 
     case ERROR_MARK:
-      return error_mark_node;
+    case NULL_EXPR:
+      return ref;
 
     default:
       gcc_unreachable ();
index bb785c689cdf27f6d35c78acd9bc838ebc15ca63..c4f66a851710664f13f4260f12bec7fb151e5966 100644 (file)
@@ -1,3 +1,8 @@
+2015-12-10  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gnat.dg/array25.adb: New test.
+       * gnat.dg/array25_pkg.ad[sb]: New helper.
+
 2015-12-10  Claudiu Zissulescu  <claziss@synopsys.com>
 
        * lib/target-supports.exp (check_effective_target_arc_atomic): New
diff --git a/gcc/testsuite/gnat.dg/array25.adb b/gcc/testsuite/gnat.dg/array25.adb
new file mode 100644 (file)
index 0000000..68dd3cb
--- /dev/null
@@ -0,0 +1,11 @@
+-- { dg-do compile }
+
+with Array25_Pkg;
+
+procedure Array25 is
+
+   package My_Pkg is new Array25_Pkg (0, 0);
+
+begin
+   null;
+end;
diff --git a/gcc/testsuite/gnat.dg/array25_pkg.adb b/gcc/testsuite/gnat.dg/array25_pkg.adb
new file mode 100644 (file)
index 0000000..9bb2fa5
--- /dev/null
@@ -0,0 +1,15 @@
+package body Array25_Pkg is
+
+   procedure Get_Inner (A : out Arr1) is
+   begin
+      null;
+   end;
+
+   procedure Get (A : out Arr2) is
+   begin
+      for I in Arr2'Range loop
+         Get_Inner (A (I).Data);
+      end loop;
+   end;
+
+end Array25_Pkg;
diff --git a/gcc/testsuite/gnat.dg/array25_pkg.ads b/gcc/testsuite/gnat.dg/array25_pkg.ads
new file mode 100644 (file)
index 0000000..1965bab
--- /dev/null
@@ -0,0 +1,19 @@
+generic
+
+   UB1 : Natural;
+
+   UB2 : Natural;
+
+package Array25_Pkg is
+
+   type Arr1 is array (1 .. UB1) of Integer;
+
+   type Rec is record
+      Data : Arr1;
+   end record;
+
+   type Arr2  is array (1 .. UB2) of Rec;
+
+   procedure Get (A : out Arr2);
+
+end Array25_Pkg;