On Mon, Sep 24, 2018 at 10:38:57PM +0300, Janne Blomqvist wrote:
> > On 24/09/18 14:54, Andreas Schwab wrote:
> > > On Sep 22 2018, Janne Blomqvist <blomqvist.ja...@gmail.com> wrote:
> > >
> > > > +! { dg-final { scan-tree-dump-times "_gfortran_caf_lock
> > \\(four.token, .*\\(1 - four.dim\\\[0\\\].lbound\\),
> > \\(integer\\(kind=4\\)\\) \\(7 - four.dim\\\[1\\\].lbound\\),
> > &acquired.\[0-9\]+, &ii, 0B, 0\\);|_gfortran_caf_lock \\(four.token, 1 -
> > four.dim\\\[0\\\].lbound, 7 - four.dim\\\[1\\\].lbound, &acquired.\[0-9\]+,
> > &ii, 0B, 0\\);" 1 "original" } }
> > > > +! { dg-final { scan-tree-dump-times "_gfortran_caf_unlock
> > \\(four.token, .*\\(2 - four.dim\\\[0\\\].lbound\\),
> > \\(integer\\(kind=4\\)\\) \\(8 - four.dim\\\[1\\\].lbound\\), 0B, 0B,
> > 0\\);|_gfortran_caf_unlock \\(four.token, 2 - four.dim\\\[0\\\].lbound, 8 -
> > four.dim\\\[1\\\].lbound, 0B, 0B, 0\\);" 1 "original" } }
> > >
> > > This is wrong for ILP32.
> > >
> >
> > To be more concrete, this FAILs on arm-none-linux-gnueabihf:
> >
> > FAIL: gfortran.dg/coarray_lock_7.f90   -O   scan-tree-dump-times original
> > "_gfortran_caf_lock \\(four.token, .*\\(1 - four.dim\\[0\\].lbound\\),
> > \\(integer\\(kind=4\\)\\) \\(7 - four.dim\\[1\\].lbound\\),
> > &acquired.[0-9]+, &ii, 0B, 0\\);|_gfortran_caf_lock \\(four.token, 1 -
> > four.dim\\[0\\].lbound, 7 - four.dim\\[1\\].lbound, &acquired.[0-9]+, &ii,
> > 0B, 0\\);" 1
> > FAIL: gfortran.dg/coarray_lock_7.f90   -O   scan-tree-dump-times original
> > "_gfortran_caf_unlock \\(four.token, .*\\(2 - four.dim\\[0\\].lbound\\),
> > \\(integer\\(kind=4\\)\\) \\(8 - four.dim\\[1\\].lbound\\), 0B, 0B,
> > 0\\);|_gfortran_caf_unlock \\(four.token, 2 - four.dim\\[0\\].lbound, 8 -
> > four.dim\\[1\\].lbound, 0B, 0B, 0\\);" 1
> 
> Ugh. My 32-bit tree is in a bit of a disarray at the moment (my lxd
> container setup didn't survive the upgrade to ubuntu 18.04), can somebody
> send me the .original tree dump?

You could just try:
make check-gfortran RUNTESTFLAGS='--target_board=unix\{-m32,-m64\} 
dg.exp=coarray_lock_7.f90'
on say x86_64-linux to see how it fails.

For -m64, the last lock/unlock are:
      _gfortran_caf_lock (four.token, (unsigned long) (1 - four.dim[0].lbound), 
(integer(kind=4)) (7 - four.dim[1].lbound), &acquired.11, &ii, 0B, 0);
    _gfortran_caf_unlock (four.token, (unsigned long) (2 - four.dim[0].lbound), 
(integer(kind=4)) (8 - four.dim[1].lbound), 0B, 0B, 0);
while for -m32, the last lock/unlock are:
      _gfortran_caf_lock (four.token, (character(kind=4)) (1 - 
four.dim[0].lbound), 7 - four.dim[1].lbound, &acquired.11, &ii, 0B, 0);
    _gfortran_caf_unlock (four.token, (character(kind=4)) (2 - 
four.dim[0].lbound), 8 - four.dim[1].lbound, 0B, 0B, 0);
The regexp expects either casts on both (which is why -m64 works), or no
casts on either, but not the case when there is a cast just on the second
argument and not on the third one.

The following patch fixes it, tested with the above make check-gfortran.

Note, there are still 4 spots that use .*, that looks dangerous to me, as it
can match many lines.  I'd suggest \[^\n\r]* instead.

2018-09-25  Jakub Jelinek  <ja...@redhat.com>

        * gfortran.dg/coarray_lock_7.f90: Adjust scan-tree-dump-times for
        ILP32.

--- gcc/testsuite/gfortran.dg/coarray_lock_7.f90.jj     2018-09-24 
10:36:53.367036614 +0200
+++ gcc/testsuite/gfortran.dg/coarray_lock_7.f90        2018-09-25 
09:48:33.057659074 +0200
@@ -41,6 +41,6 @@ end
 ! { dg-final { scan-tree-dump-times "_gfortran_caf_lock \\(three.token, 0, 
\\(integer\\(kind=4\\)\\) \\(5 - three.dim\\\[0\\\].lbound\\), 
&acquired.\[0-9\]+, 0B, 0B, 0\\);|_gfortran_caf_lock \\(three.token, 0, 5 - 
three.dim\\\[0\\\].lbound, &acquired.\[0-9\]+, 0B, 0B, 0\\);" 1 "original" } }
 ! { dg-final { scan-tree-dump-times "_gfortran_caf_unlock \\(three.token, 0, 
\\(integer\\(kind=4\\)\\) \\(8 - three.dim\\\[0\\\].lbound\\), &ii, 0B, 
0\\);|_gfortran_caf_unlock \\(three.token, 0, 8 - three.dim\\\[0\\\].lbound, 
&ii, 0B, 0\\);" 1 "original" } }
 
-! { dg-final { scan-tree-dump-times "_gfortran_caf_lock \\(four.token, .*\\(1 
- four.dim\\\[0\\\].lbound\\), \\(integer\\(kind=4\\)\\) \\(7 - 
four.dim\\\[1\\\].lbound\\), &acquired.\[0-9\]+, &ii, 0B, 
0\\);|_gfortran_caf_lock \\(four.token, 1 - four.dim\\\[0\\\].lbound, 7 - 
four.dim\\\[1\\\].lbound, &acquired.\[0-9\]+, &ii, 0B, 0\\);" 1 "original" } }
-! { dg-final { scan-tree-dump-times "_gfortran_caf_unlock \\(four.token, 
.*\\(2 - four.dim\\\[0\\\].lbound\\), \\(integer\\(kind=4\\)\\) \\(8 - 
four.dim\\\[1\\\].lbound\\), 0B, 0B, 0\\);|_gfortran_caf_unlock \\(four.token, 
2 - four.dim\\\[0\\\].lbound, 8 - four.dim\\\[1\\\].lbound, 0B, 0B, 0\\);" 1 
"original" } }
+! { dg-final { scan-tree-dump-times "_gfortran_caf_lock \\(four.token, .*\\(1 
- four.dim\\\[0\\\].lbound\\), \\(integer\\(kind=4\\)\\) \\(7 - 
four.dim\\\[1\\\].lbound\\), &acquired.\[0-9\]+, &ii, 0B, 
0\\);|_gfortran_caf_lock \\(four.token, \[^\n\r]*1 - 
four.dim\\\[0\\\].lbound\\)?, 7 - four.dim\\\[1\\\].lbound, &acquired.\[0-9\]+, 
&ii, 0B, 0\\);" 1 "original" } }
+! { dg-final { scan-tree-dump-times "_gfortran_caf_unlock \\(four.token, 
.*\\(2 - four.dim\\\[0\\\].lbound\\), \\(integer\\(kind=4\\)\\) \\(8 - 
four.dim\\\[1\\\].lbound\\), 0B, 0B, 0\\);|_gfortran_caf_unlock \\(four.token, 
\[^\n\r]*2 - four.dim\\\[0\\\].lbound\\)?, 8 - four.dim\\\[1\\\].lbound, 0B, 
0B, 0\\);" 1 "original" } }
 


        Jakub

Reply via email to