On Wed, 2005-04-27 at 16:19 +0200, Richard Guenther wrote: > fold_indirect_ref, called from the gimplifier happily converts > > const char *a; > > ... > > *(char *)&a[x] = 0; > > to > > a[x] = 0; > > confusing alias1 and ICEing in verify_ssa: > > /net/alwazn/home/rguenth/src/gcc/cvs/gcc-4.1/gcc/testsuite/gcc.c-torture/execute/20031215-1.c:11: > error: Statement makes a memory store, but has no V_MAY_DEFS nor > V_MUST_DEFS > # VUSE <ao_1>; > ao.ch[D.1242_5] = 0; > /net/alwazn/home/rguenth/src/gcc/cvs/gcc-4.1/gcc/testsuite/gcc.c-torture/execute/20031215-1.c:11: > internal compiler error: verify_ssa failed. > > happens only for patched gcc where C frontend and fold happen to > produce .02.original: > > ;; Function test1 (test1) > ;; enabled by -tree-original > > > { > if (ao.ch[ao.l] != 0) > { > *(char *) &ao.ch[(unsigned int) ao.l] = 0; > } > } > > then, generic is already wrong: > > test1 () > { > int D.1240; > char D.1241; > unsigned int D.1242; > > D.1240 = ao.l; > D.1241 = ao.ch[D.1240]; > if (D.1241 != 0) > { > D.1240 = ao.l; > D.1242 = (unsigned int) D.1240; > ao.ch[D.1242] = 0; > } > > (note the missing cast). > > > something like the following patch fixes this. Right. Given that I'd seen similar problems with some unrelated changes of mine, I went ahead and put your patch through the usual bootstrap and regression tests on my i686 box.
Installed.
* tree-ssa-ccp.c (maybe_fold_stmt_indirect): Use STRIP_TYPE_NOPS rather than STRIP_NOPS. Index: tree-ssa-ccp.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/tree-ssa-ccp.c,v retrieving revision 2.68 diff -c -p -r2.68 tree-ssa-ccp.c *** tree-ssa-ccp.c 3 May 2005 12:19:42 -0000 2.68 --- tree-ssa-ccp.c 3 May 2005 14:11:10 -0000 *************** maybe_fold_stmt_indirect (tree expr, tre *** 1585,1591 **** substitutions. Fold that down to one. Remove NON_LVALUE_EXPRs that are sometimes added. */ base = fold (base); ! STRIP_NOPS (base); TREE_OPERAND (expr, 0) = base; /* One possibility is that the address reduces to a string constant. */ --- 1585,1591 ---- substitutions. Fold that down to one. Remove NON_LVALUE_EXPRs that are sometimes added. */ base = fold (base); ! STRIP_TYPE_NOPS (base); TREE_OPERAND (expr, 0) = base; /* One possibility is that the address reduces to a string constant. */