This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: fold_indirect_ref bogous
- From: Jeffrey A Law <law at redhat dot com>
- To: Richard Guenther <rguenth at tat dot physik dot uni-tuebingen dot de>
- Cc: gcc at gcc dot gnu dot org
- Date: Wed, 27 Apr 2005 10:24:46 -0600
- Subject: Re: fold_indirect_ref bogous
- Organization: Red Hat, Inc
- References: <Pine.LNX.4.44.0504271614390.7457-100000@alwazn.tat.physik.uni-tuebingen.de>
- Reply-to: law at redhat dot com
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;
> }
>
> (not the missing cast).
>
>
> something like the following patch fixes this.
How ironic. I ran into a similar problem with the fold-after-TER
patches. I just killed the STRIP_NOPS call, but using STRIP_TYPE_NOPS
might be a better solution.
jeff