* fold-const.c (fold_indirect_ref_1): Make sure we fold
ARRAY_REFs of constant strings.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@107229
138bc75d-0d04-0410-961f-
82ee72b054a4
+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
{
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))