Commit a239279e by Eric Botcazou Committed by Eric Botcazou

trans.c (fold_constant_decl_in_expr): If the index is not itself constant then bail out.

	* gcc-interface/trans.c (fold_constant_decl_in_expr) <ARRAY_REF>: If
	the index is not itself constant then bail out.

From-SVN: r230558
parent 70318db4
2015-11-18 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/trans.c (fold_constant_decl_in_expr) <ARRAY_REF>: If
the index is not itself constant then bail out.
2015-11-18 Ed Schonberg <schonberg@adacore.com> 2015-11-18 Ed Schonberg <schonberg@adacore.com>
* sem_ch4.adb (Try_Container_Indexing): When constructing the * sem_ch4.adb (Try_Container_Indexing): When constructing the
......
...@@ -975,6 +975,9 @@ fold_constant_decl_in_expr (tree exp) ...@@ -975,6 +975,9 @@ fold_constant_decl_in_expr (tree exp)
case ARRAY_REF: case ARRAY_REF:
case ARRAY_RANGE_REF: case ARRAY_RANGE_REF:
/* If the index is not itself constant, then nothing can be folded. */
if (!TREE_CONSTANT (TREE_OPERAND (exp, 1)))
return exp;
op0 = fold_constant_decl_in_expr (TREE_OPERAND (exp, 0)); op0 = fold_constant_decl_in_expr (TREE_OPERAND (exp, 0));
if (op0 == TREE_OPERAND (exp, 0)) if (op0 == TREE_OPERAND (exp, 0))
return exp; return exp;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment