This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] Fix ICE on conditional expression with unconstrained type


This is again the compiler trying to create a temporary, for an unconstrained 
type hence whose size isn't fixed.  Fixed by not creating the temporary as it 
is superfluous here.

Tested on i586-suse-linux, applied on the mainline


2011-06-06  Eric Botcazou  <ebotcazou@adacore.com>

	* gcc-interface/utils2.c (gnat_stabilize_reference) <COMPOUND_EXPR>:
	Fix thinko.


2011-06-06  Eric Botcazou  <ebotcazou@adacore.com>

	* gnat.dg/specs/cond_expr1.ads: New test.


-- 
Eric Botcazou
-- { dg-do compile }
-- { dg-options "-gnat12 -gnato" }

package Cond_Expr1 is

   function Tail (S : String) return String is
     (if S'Last <= S'First then "" else S (S'First + 1 .. S'Last));

end Cond_Expr1;
Index: gcc-interface/utils2.c
===================================================================
--- gcc-interface/utils2.c	(revision 174631)
+++ gcc-interface/utils2.c	(working copy)
@@ -2518,8 +2518,8 @@ gnat_stabilize_reference (tree ref, bool
       result = build2 (COMPOUND_EXPR, type,
 		       gnat_stabilize_reference (TREE_OPERAND (ref, 0), force,
 						 success),
-		       gnat_stabilize_reference_1 (TREE_OPERAND (ref, 1),
-						   force));
+		       gnat_stabilize_reference (TREE_OPERAND (ref, 1), force,
+						 success));
       break;
 
     case CONSTRUCTOR:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]