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:
parent
815d8045e0
commit
41b9109a55
|
@ -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>
|
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)
|
||||||
{
|
{
|
||||||
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)
|
||||||
return op;
|
{
|
||||||
|
tree fop = fold_read_from_constant_string (op);
|
||||||
|
if (fop)
|
||||||
|
return fop;
|
||||||
|
else
|
||||||
|
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))
|
||||||
|
|
Loading…
Reference in New Issue