This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: fold_indirect_ref bogous


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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]