]> git.pld-linux.org Git - packages/gcc.git/blame - gcc-pr24172.patch
- updated to 4.1.0-20051019T0822UTC + 5 critical fixes.
[packages/gcc.git] / gcc-pr24172.patch
CommitLineData
d09ee599
PS
1This fixes the PR by making sure we fold "foo"[0] to 'f'
2during fold_indirect_ref.
3
4 PR tree-optimization/24172
5 * fold-const.c (fold_indirect_ref_1): Make sure we fold
6 ARRAY_REFs of constant strings.
7
8 * g++.dg/tree-ssa/pr24172.C: New testcase.
9
10
11*** gcc/gcc/fold-const.c 26 Sep 2005 01:28:38 -0000 1.626
12--- gcc/gcc/fold-const.c 4 Oct 2005 10:59:06 -0000
13*************** fold_indirect_ref_1 (tree type, tree op0
14*** 11511,11519 ****
15 {
16 tree op = TREE_OPERAND (sub, 0);
17 tree optype = TREE_TYPE (op);
18! /* *&p => p */
19 if (type == optype)
20! return op;
21 /* *(foo *)&fooarray => fooarray[0] */
22 else if (TREE_CODE (optype) == ARRAY_TYPE
23 && type == TREE_TYPE (optype))
24--- 11511,11525 ----
25 {
26 tree op = TREE_OPERAND (sub, 0);
27 tree optype = TREE_TYPE (op);
28! /* *&p => p; make sure to handle *&"str"[cst] here. */
29 if (type == optype)
30! {
31! tree fop = fold_read_from_constant_string (op);
32! if (fop)
33! return fop;
34! else
35! return op;
36! }
37 /* *(foo *)&fooarray => fooarray[0] */
38 else if (TREE_CODE (optype) == ARRAY_TYPE
39 && type == TREE_TYPE (optype))
This page took 0.058817 seconds and 4 git commands to generate.