Commit 41b9109a by Richard Guenther Committed by Richard Biener

fold-const.c (fold_indirect_ref_1): Make sure we fold ARRAY_REFs of constant strings.

2005-11-19  Richard Guenther  <rguenther@suse.de>

	* fold-const.c (fold_indirect_ref_1): Make sure we fold
	ARRAY_REFs of constant strings.

From-SVN: r107229
parent 815d8045
2005-11-19 Richard Guenther <rguenther@suse.de>
* fold-const.c (fold_indirect_ref_1): Make sure we fold
ARRAY_REFs of constant strings.
2005-11-19 Jakub Jelinek <jakub@redhat.com> 2005-11-19 Jakub Jelinek <jakub@redhat.com>
* gcc.c (version_compare_spec_function): Use '%s' rather than %qs in * gcc.c (version_compare_spec_function): Use '%s' rather than %qs in
......
...@@ -11523,9 +11523,15 @@ fold_indirect_ref_1 (tree type, tree op0) ...@@ -11523,9 +11523,15 @@ fold_indirect_ref_1 (tree type, tree op0)
{ {
tree op = TREE_OPERAND (sub, 0); tree op = TREE_OPERAND (sub, 0);
tree optype = TREE_TYPE (op); tree optype = TREE_TYPE (op);
/* *&p => p */ /* *&p => p; make sure to handle *&"str"[cst] here. */
if (type == optype) if (type == optype)
{
tree fop = fold_read_from_constant_string (op);
if (fop)
return fop;
else
return op; return op;
}
/* *(foo *)&fooarray => fooarray[0] */ /* *(foo *)&fooarray => fooarray[0] */
else if (TREE_CODE (optype) == ARRAY_TYPE else if (TREE_CODE (optype) == ARRAY_TYPE
&& type == TREE_TYPE (optype)) && type == TREE_TYPE (optype))
......
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