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
This commit is contained in:
Richard Guenther 2005-11-19 21:40:28 +00:00 committed by Richard Biener
parent 815d8045e0
commit 41b9109a55
2 changed files with 13 additions and 2 deletions

View File

@ -1,3 +1,8 @@
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>
* gcc.c (version_compare_spec_function): Use '%s' rather than %qs in

View File

@ -11523,9 +11523,15 @@ fold_indirect_ref_1 (tree type, tree op0)
{
tree op = TREE_OPERAND (sub, 0);
tree optype = TREE_TYPE (op);
/* *&p => p */
/* *&p => p; make sure to handle *&"str"[cst] here. */
if (type == optype)
return op;
{
tree fop = fold_read_from_constant_string (op);
if (fop)
return fop;
else
return op;
}
/* *(foo *)&fooarray => fooarray[0] */
else if (TREE_CODE (optype) == ARRAY_TYPE
&& type == TREE_TYPE (optype))