gimplify.c (gimplify_modify_expr_rhs): Gimplify the LHS using the is_gimple_lvalue...
authorEric Botcazou <ebotcazou@adacore.com>
Fri, 18 Apr 2008 18:18:53 +0000 (18:18 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Fri, 18 Apr 2008 18:18:53 +0000 (18:18 +0000)
* gimplify.c (gimplify_modify_expr_rhs) <COND_EXPR>: Gimplify the LHS
using the is_gimple_lvalue predicate instead of is_gimple_min_lval.

From-SVN: r134442

gcc/ChangeLog
gcc/gimplify.c
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/dynamic_elab1.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/dynamic_elab1.ads [new file with mode: 0644]
gcc/testsuite/gnat.dg/dynamic_elab2.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/dynamic_elab2.ads [new file with mode: 0644]
gcc/testsuite/gnat.dg/dynamic_elab_pkg.ads [new file with mode: 0644]

index 81d4f5d1ea2e95431684523221cc7111b7bb22d0..c3296981345348f3add9f86d8f9f747155f11ff4 100644 (file)
@@ -1,3 +1,8 @@
+2008-04-18  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gimplify.c (gimplify_modify_expr_rhs) <COND_EXPR>: Gimplify the LHS
+       using the is_gimple_lvalue predicate instead of is_gimple_min_lval.
+
 2008-04-18  Tom Tromey  <tromey@redhat.com>
 
        PR libcpp/15500:
index cc9fd1505ec3310f9dd7cc38bc5f98dd77e0d2dd..52f63c1fc0d84f0d902a3d45849754ff226e63db 100644 (file)
@@ -3636,7 +3636,7 @@ gimplify_modify_expr_rhs (tree *expr_p, tree *from_p, tree *to_p, tree *pre_p,
            tree result = *to_p;
 
            ret = gimplify_expr (&result, pre_p, post_p,
-                                is_gimple_min_lval, fb_lvalue);
+                                is_gimple_lvalue, fb_lvalue);
            if (ret != GS_ERROR)
              ret = GS_OK;
 
index e839cde86308c6eea4e6c5c12162cef18aaa7643..3ef066ad9e4582ac249fe5399a2dbd400eef8a7b 100644 (file)
@@ -1,3 +1,9 @@
+2008-04-18  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gnat.dg/dynamic_elab_pkg.ads: New helper.
+       * gnat.dg/dynamic_elab1.ad[sb]: New test.
+       * gnat.dg/dynamic_elab2.ad[sb]: Likewise.
+
 2008-04-18  Kris Van Hees <kris.van.hees@oracle.com>
 
        Tests for char16_t and char32_t support.
diff --git a/gcc/testsuite/gnat.dg/dynamic_elab1.adb b/gcc/testsuite/gnat.dg/dynamic_elab1.adb
new file mode 100644 (file)
index 0000000..88f7668
--- /dev/null
@@ -0,0 +1,20 @@
+-- { dg-do compile }
+-- { dg-options "-gnatE" }
+
+package body Dynamic_Elab1 is
+
+  function Get_Plot return Plot is
+
+    procedure Fill (X : out Plot) is
+    begin
+      X.Data := Get_R;
+    end;
+
+  X : Plot;
+
+  begin
+    Fill(X);
+    return X;
+  end;
+
+end Dynamic_Elab1;
diff --git a/gcc/testsuite/gnat.dg/dynamic_elab1.ads b/gcc/testsuite/gnat.dg/dynamic_elab1.ads
new file mode 100644 (file)
index 0000000..c241e54
--- /dev/null
@@ -0,0 +1,12 @@
+with Dynamic_Elab_Pkg; use Dynamic_Elab_Pkg;
+
+package Dynamic_Elab1 is
+
+  type Plot is record
+    Data : R;
+  end record;
+  pragma Pack (Plot);
+
+  function Get_Plot return Plot;
+
+end Dynamic_Elab1;
diff --git a/gcc/testsuite/gnat.dg/dynamic_elab2.adb b/gcc/testsuite/gnat.dg/dynamic_elab2.adb
new file mode 100644 (file)
index 0000000..138d130
--- /dev/null
@@ -0,0 +1,20 @@
+-- { dg-do compile }
+-- { dg-options "-gnatE" }
+
+package body Dynamic_Elab2 is
+
+  function Get_Plot return Plot is
+
+    procedure Fill (X : out Plot) is
+    begin
+      X.Data := Get_R;
+    end;
+
+  X : Plot;
+
+  begin
+    Fill(X);
+    return X;
+  end;
+
+end Dynamic_Elab2;
diff --git a/gcc/testsuite/gnat.dg/dynamic_elab2.ads b/gcc/testsuite/gnat.dg/dynamic_elab2.ads
new file mode 100644 (file)
index 0000000..9191dab
--- /dev/null
@@ -0,0 +1,13 @@
+with Dynamic_Elab_Pkg; use Dynamic_Elab_Pkg;
+
+package Dynamic_Elab2 is
+
+  type Plot is record
+    B : Boolean;
+    Data : R;
+  end record;
+  pragma Pack (Plot);
+
+  function Get_Plot return Plot;
+
+end Dynamic_Elab2;
diff --git a/gcc/testsuite/gnat.dg/dynamic_elab_pkg.ads b/gcc/testsuite/gnat.dg/dynamic_elab_pkg.ads
new file mode 100644 (file)
index 0000000..2e2574f
--- /dev/null
@@ -0,0 +1,10 @@
+package Dynamic_Elab_Pkg is
+
+  type R is record
+    Code : Integer;
+    Val  : Boolean;
+  end record;
+
+  function Get_R return R;
+
+end Dynamic_Elab_Pkg;