Two of the following three subroutines abort at run time.
They have run time zero sized arrays that have "different"
zero sizes as arguments to matmul. If the zeroness is visible
at compile time or if the zeroness has the same "size", the
similar subroutines do not abort
Dick Hendrickson
program try_gf1003
! fails on Windows XP
! gcc version 4.4.0 20080312 (experimental) [trunk revision 133139]
call gf1003a( 9, 8, 6)
call gf1003b( 9, 8, 6)
call gf1003c( 9, 8, 6) !fails
call gf1003d( 9, 8, 6) !fails
end program
SUBROUTINE GF1003a(nf9,nf8,nf6)
REAL RDA(3,2)
REAL RDA1(3,5)
REAL RDA2(5,2)
print *, 'gf1003a started'
RDA = MATMUL(RDA1(:, 9:8),RDA2( 8:6,:))
print *, 'gf1003a finished'
END SUBROUTINE
SUBROUTINE GF1003b(nf9,nf8,nf6)
REAL RDA(3,2)
REAL RDA1(3,0)
REAL RDA2(0,2)
print *, 'gf1003b started'
RDA = MATMUL(RDA1(:,NF9:NF8),RDA2(NF9:NF8,:))
print *, 'gf1003b finished'
END SUBROUTINE
SUBROUTINE GF1003c(nf9,nf8,nf6)
REAL RDA(3,2)
REAL RDA1(3,0)
REAL RDA2(0,2)
print *, 'gf1003c started'
RDA = MATMUL(RDA1(:,NF9:NF8),RDA2(NF8:NF6,:))
print *, 'gf1003c finished'
END SUBROUTINE
SUBROUTINE GF1003d(nf9,nf8,nf6)
REAL RDA(3,2)
REAL RDA1(3,5)
REAL RDA2(5,2)
print *, 'gf1003d started'
RDA = MATMUL(RDA1(:,NF9:NF8),RDA2(NF8:NF6,:))
print *, 'gf1003d finished'
END SUBROUTINE
C:\gfortran:gfortran gf1003.f
C:\gfortran:a
gf1003a started
gf1003a finished
gf1003b started
gf1003b finished
gf1003c started
Fortran runtime error: dimension of array B incorrect in MATMUL intrinsic
--
Summary: run-time abort for MATMUL of run-time zero sized array
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: dick dot hendrickson at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35988