diff mbox

[fortran] PR 37131

Message ID 2F768FE7-487F-49FA-9A6C-3216021145B2@lps.ens.fr
State New
Headers show

Commit Message

Dominique d'Humières April 20, 2015, 7:57 p.m. UTC
I have played a little bit with the patched gfortran.

(1) gfortran.dg/coarray_lib_this_image_2.f90 is still failing

FAIL: gfortran.dg/coarray_lib_this_image_2.f90   -O   scan-tree-dump-times original "mylbound = parm...dim\\[0\\].stride >= 0 && parm...dim\\[0\\].ubound >= parm...dim\\[0\\].lbound \\|\\| parm...dim\\[0\\].stride < 0 \\?[^\n\r]* parm...dim\\[0\\].lbound : 1; » 1

I did not look to the reason, but silenced the failure with the following patch


(2) -finline-matmul-limit works only as -finline-matmul-limit=0, any other value does not seem to be taken into account at least when compiling with -fexternal-blas (same thing for -fblas-matmul-limit=n). Note that I have only tried a few combinations.

(3) From Mikael’ comment

> To sum um, tests missing for the following:
>	array(4,:,:)

This does not work. I have played with the following code:

implicit none
type comp
  real :: r
end type
integer :: i
real :: a(10,10), b(10,10), c(10,10), c1(10,10)
real :: a2(5,5), b2(5,5), c2(5,5), c3(5,5)
real :: a3(5,10,10), b3(5,10,10)
real :: a1(-1:8, 2:11), b1(2:11, -1:8)
type(comp) :: f(10,10), g(10,10)
a = reshape([(i,i=1,100)],[10,10])
b = reshape([(i-50,i=1,100)],[10,10])
a1 = a
b1 = b
c = matmul(a,b)
c1 = matmul(a1,b1)
if(any(c/=c1)) print *, "pb"
a3(4,:,:) = a
b3(4,:,:) = b
c1 = matmul(a3(4,:,:),b3(4,:,:))
if(any(c/=c1)) print *, "pb"
f%r = a
g%r = b
c1 = matmul(f%r,g%r)
if(any(c/=c1)) print *, "pb"
a2 = a(1::2,1::2)
b2 = b(1::2,1::2)
c2 = matmul(a2,b2)
c3 = matmul(a1(-1::2,2::2), b1(2::2, -1::2))
if(any(c2/=c3)) print *, "pb »
end

For which I get the errors

[Book15] f90/bug% gfc pr37131_sec.f90 -fdump-tree-optimized -O2
pr37131_sec.f90:20:12:

 c1 = matmul(a3(4,:,:),b3(4,:,:))
            1
Error: DIM argument at (1) is out of bounds
pr37131_sec.f90:20:12: Error: DIM argument at (1) is out of bounds
pr37131_sec.f90:20:12: Error: DIM argument at (1) is out of bounds
pr37131_sec.f90:20:22:

 c1 = matmul(a3(4,:,:),b3(4,:,:))
                      1
Error: DIM argument at (1) is out of bounds
pr37131_sec.f90:20:22: Error: DIM argument at (1) is out of bounds
pr37131_sec.f90:20:22: Error: DIM argument at (1) is out of bounds
pr37131_sec.f90:20:12:

 c1 = matmul(a3(4,:,:),b3(4,:,:))
            1
Error: DIM argument at (1) is out of bounds
pr37131_sec.f90:20:12: Error: DIM argument at (1) is out of bounds

If the line

 c1 = matmul(a3(4,:,:),b3(4,:,:))

is commented, the code compiles, runs without printing "pb", and the MATMULs are optimized.

Thanks for the great work,

Dominique
diff mbox

Patch

--- ../_clean/gcc/testsuite/gfortran.dg/coarray_lib_this_image_2.f90	2014-05-03 11:08:31.000000000 +0200
+++ gcc/testsuite/gfortran.dg/coarray_lib_this_image_2.f90	2015-04-20 16:52:07.000000000 +0200
@@ -20,7 +20,7 @@  end
 ! { dg-final { scan-tree-dump-times "mylcobound = 5;" 1 "original" } }
 ! { dg-final { scan-tree-dump-times "parm...dim\\\[1\\\].lbound = 5;" 1 "original" } }
 ! { dg-final { scan-tree-dump-times "myucobound =\[^\n\r\]* parm...dim\\\[1\\\].lbound \\+ \[^\n\r\]*_gfortran_caf_num_images \\(0, -1\\).? \\+ -?\[0-9\]+\\);" 1 "original" } }
-! { dg-final { scan-tree-dump-times "mylbound = parm...dim\\\[0\\\].stride >= 0 && parm...dim\\\[0\\\].ubound >= parm...dim\\\[0\\\].lbound \\|\\| parm...dim\\\[0\\\].stride < 0 \\?\[^\n\r\]* parm...dim\\\[0\\\].lbound : 1;" 1 "original" } }
+! { dg-final { scan-tree-dump-times "mylbound = parm...dim\\\[0\\\].stride >= 0 && parm...dim\\\[0\\\].ubound >= parm...dim\\\[0\\\].lbound \\|\\| parm...dim\\\[0\\\].stride < 0 \\?\[^\n\r\]* parm...dim\\\[0\\\].lbound : 1;" 1 "original" { xfail *-*-* } } }
 ! { dg-final { scan-tree-dump-times "mythis_image = _gfortran_caf_this_image \\(0\\);" 1 "original" } }
 ! { dg-final { scan-tree-dump-times "bar \\(&parm.\[0-9\]+, caf_token.\[0-9\]+, \\(integer\\(kind=\[48\]\\)\\) parm.\[0-9\]+.data - \\(integer\\(kind=\[48\]\\)\\) x\\);" 1 "original" } }
 ! { dg-final { scan-tree-dump-times "_gfortran_caf_init \\(&argc, &argv\\);" 1 "original" } }