Commit 06eaa86f by Jim Wilson Committed by Jim Wilson

Fix bug where storing into const string gives core dump, from Kamil Iskra.

	* expr.c (expand_expr, case INDIRECT_REF): Don't optimize string
	reference if this is a store.

From-SVN: r19531
parent 9ed5dc54
Mon May 4 19:15:29 1998 Jim Wilson <wilson@cygnus.com>
* expr.c (expand_expr, case INDIRECT_REF): Don't optimize string
reference if this is a store.
Mon May 4 17:25:17 1998 Richard Henderson <rth@cygnus.com> Mon May 4 17:25:17 1998 Richard Henderson <rth@cygnus.com>
* sparc.c (output_move_quad): Fix typo in mov_by_64 argument. * sparc.c (output_move_quad): Fix typo in mov_by_64 argument.
......
...@@ -5484,13 +5484,15 @@ expand_expr (exp, target, tmode, modifier) ...@@ -5484,13 +5484,15 @@ expand_expr (exp, target, tmode, modifier)
tree string = string_constant (exp1, &index); tree string = string_constant (exp1, &index);
int i; int i;
/* Try to optimize reads from const strings. */
if (string if (string
&& TREE_CODE (string) == STRING_CST && TREE_CODE (string) == STRING_CST
&& TREE_CODE (index) == INTEGER_CST && TREE_CODE (index) == INTEGER_CST
&& !TREE_INT_CST_HIGH (index) && !TREE_INT_CST_HIGH (index)
&& (i = TREE_INT_CST_LOW (index)) < TREE_STRING_LENGTH (string) && (i = TREE_INT_CST_LOW (index)) < TREE_STRING_LENGTH (string)
&& GET_MODE_CLASS (mode) == MODE_INT && GET_MODE_CLASS (mode) == MODE_INT
&& GET_MODE_SIZE (mode) == 1) && GET_MODE_SIZE (mode) == 1
&& modifier != EXPAND_MEMORY_USE_WO)
return GEN_INT (TREE_STRING_POINTER (string)[i]); return GEN_INT (TREE_STRING_POINTER (string)[i]);
op0 = expand_expr (exp1, NULL_RTX, VOIDmode, EXPAND_SUM); op0 = expand_expr (exp1, NULL_RTX, VOIDmode, EXPAND_SUM);
......
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