> > > 
> > > 2020-10-15  Jakub Jelinek  <ja...@redhat.com>
> > > 
> > >   * gcc.dg/ipa/modref-1.c: Remove space between param offset: and number
> > >   in scan-ipa-dump.
> > >   (b): Declare return type to void.
> > >   (main): Declare return type to int.  Change c to array of 3 chars.
> > >   * gcc.dg/tree-ssa/modref-4.c: Remove space between param offset: and
> > >   number in scan-ipa-dump.  Use modref1 instead of modref2.
> > >   (b): Declare return type to void.
> > >   (main): Declare return type to int.  Change c to array of 3 chars.
> > Sorry for that - I had fixed versions of the testcases but must have
> > mixed the up.   I will look at the reutrn 0 case.
> 
> Note that even if it optimized as much as it ever could, return 0 is not the
> correct value, while c[0] is unmodified and the optimization
> correctly proves that it isn't and optimizes it into 0, c[2] is modified -
> it is changed from 0 to 1.  Perhaps you meant c[4]={0,1,0,0}; and check
> if c[0]+c[3] is optimized into 0?
Yep, I was trying to check that both offset and size are correctly
determined.  I applied the folowing:

        * gcc.dg/tree-ssa/modref-4.c: Fix return test.

diff --git a/gcc/testsuite/gcc.dg/tree-ssa/modref-4.c 
b/gcc/testsuite/gcc.dg/tree-ssa/modref-4.c
index 97fe5307a1c..3ac217bafb8 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/modref-4.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/modref-4.c
@@ -15,9 +15,9 @@ void b(char *ptr)
 
 int main()
 {
-  char c[3]={0,1,0};
+  char c[4]={0,1,2,0};
   b(c);
-  return c[0]+c[2];
+  return c[0]+c[3];
 }
 /* Check that both param offsets are determined correctly and the computation
    is optimized out.  */

Reply via email to