diff mbox

[Ada] Fix internal error on loop over array with misaligned index

Message ID 272522743.8yFuboCKnV@polaris
State New
Headers show

Commit Message

Eric Botcazou March 6, 2013, 5:47 p.m. UTC
This is a regression present on the mainline.  The compiler aborts on a loop 
running over an array whose index type is a misaligned scalar type at -O3.

We're just forgetting to lift the padding type around the scalar type.

Tested on x86_64-suse-linux, applied on the mainline.


2013-06-03  Eric Botcazou  <ebotcazou@adacore.com>

	* gcc-interface/trans.c (Raise_Error_to_gnu) <CE_Index_Check_Failed>:
	Record the unpadded type of the index type on the RCI stack.


2013-06-03  Eric Botcazou  <ebotcazou@adacore.com>

	* gnat.dg/loop_optimization15.ad[sb]: New test.
diff mbox

Patch

Index: gcc-interface/trans.c
===================================================================
--- gcc-interface/trans.c	(revision 196500)
+++ gcc-interface/trans.c	(working copy)
@@ -4944,7 +4944,7 @@  Raise_Error_to_gnu (Node_Id gnat_node, t
 	    {
 	      rci->low_bound = gnu_low_bound;
 	      rci->high_bound = gnu_high_bound;
-	      rci->type = gnat_to_gnu_type (gnat_type);
+	      rci->type = get_unpadded_type (gnat_type);
 	      rci->invariant_cond = build1 (SAVE_EXPR, boolean_type_node,
 					    boolean_true_node);
 	      gnu_cond = build_binary_op (TRUTH_ANDIF_EXPR,