trans.c (emit_check): Put back a final save_expr to prevent exponential expansion...
authorGeert Bosch <bosch@adacore.com>
Sat, 15 Nov 2008 14:11:58 +0000 (14:11 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Sat, 15 Nov 2008 14:11:58 +0000 (14:11 +0000)
* gcc-interface/trans.c (emit_check): Put back a final save_expr
to prevent exponential expansion during gimplification.

From-SVN: r141885

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

index adbc571c1a69414d3d4c83d45de70c4ae7d1f3e6..ec605ab78627365eaf6ab25dab5b17d049674616 100644 (file)
@@ -1,3 +1,8 @@
+2008-11-15  Geert Bosch  <bosch@adacore.com>
+
+       * gcc-interface/trans.c (emit_check): Put back a final save_expr
+       to prevent exponential expansion during gimplification.
+
 2008-11-15  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gcc-interface/lang-specs.h: Expand -coverage and reorder switches.
index 8ededaa49b2cbecbcfc781f54d57e7eb7c2496e9..51d20d26e1d1d386a74eaf9cd8fa780b43a745d8 100644 (file)
@@ -6289,7 +6289,10 @@ emit_check (tree gnu_cond, tree gnu_expr, int reason)
      we don't need to evaluate it just for the check.  */
   TREE_SIDE_EFFECTS (gnu_result) = TREE_SIDE_EFFECTS (gnu_expr);
 
-  return gnu_result;
+  /* ??? Unfortunately, if we don't put a SAVE_EXPR around this whole thing,
+     we will repeatedly do the test and, at compile time, we will repeatedly
+     visit it during unsharing, which leads to an exponential explosion.  */
+  return save_expr (gnu_result);
 }
 \f
 /* Return an expression that converts GNU_EXPR to GNAT_TYPE, doing