This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Questions about the gfortran test suite
- From: dominiq at lps dot ens dot fr (Dominique Dhumieres)
- To: fortran at gcc dot gnu dot org
- Date: Tue, 27 Dec 2005 10:28:06 +0100
- Subject: Questions about the gfortran test suite
I have some question about some tests in the gfortran test suite:
(A) ----------------------------------------------
In ../gcc-4.2-20051224/gcc/testsuite/gfortran.fortran-torture/execute
% cat math.f90
! Program to test mathematical intrinsics
subroutine dotest (n, val4, val8, known)
...
end subroutine
subroutine dotestc (n, val4, val8, known)
...
end subroutine
program testmath
implicit none
real(kind=4) r, two4, half4
real(kind=8) q, two8, half8
complex(kind=4) cr
complex(kind=8) cq
external dotest, dotest2
...
end program
It seems quite likely that 'dotest2' is a typo for 'dotestc'.
Does the "standard" says anything about this case of unused external:
should(could) it emit a warning(error)?
should(could) it forward the unused external to the linker?
(B) ----------------------------------------------
In ../gcc-4.2-20051224/gcc/testsuite/gfortran.fortran-torture/execute
% cat pr23373-2.f90
program main
...
contains
function test
...
end function test
end program main
As far as I can tell this function definition is an extension:
[prefix] FUNCTION name ([d-arg-list]) [RESULT (r-name)]
[prefix] SUBROUTINE name [([d-arg-list])]
i.e., the parentheses after 'name' seem mandatory. In the Intel Fortran
manual the omission of these parentheses when '[d-arg-list]' is empty is
listed as an extension.
(a) This extension is not detected by the -std=f95 flag as it should.
(b) Is it sound to use such an extension in a general test?
(C) ----------------------------------------------
In ../gcc-4.2-20051224/gcc/testsuite/gfortran.dg
% cat namelist_15.f90
!{ dg-do run }
! Tests arrays of derived types containing derived type arrays whose
! components are character arrays - exercises object name parser in
! list_read.c. Checks that namelist output can be reread.
! provided by Paul Thomas - pault@gcc.gnu.org
module global
type :: mt
character(len=2) :: ch(2) = (/"aa","bb"/)
end type mt
type :: bt
integer :: i(2) = (/1,2/)
type(mt) :: m(2)
end type bt
end module global
program namelist_15
use global
type(bt) :: x(2)
namelist /mynml/ x
open (10, status = "scratch")
write (10, '(A)') "&MYNML"
write (10, '(A)') " x = 3, 4, 'dd', 'ee', 'ff', 'gg',"
write (10, '(A)') " 4, 5, 'hh', 'ii', 'jj', 'kk',"
write (10, '(A)') " x%i = , ,-3, -4"
write (10, '(A)') " x(2)%m(1)%ch(2) ='q',"
write (10, '(A)') " x(2)%m(2)%ch(1)(1) ='w',"
write (10, '(A)') " x%m%ch(:)(2) = 'z','z','z','z','z','z','z','z',"
write (10, '(A)') "&end"
rewind (10)
read (10, nml = mynml, iostat = ier)
...
end program namelist_15
I have tested this program with all the compilers I have at hand (xlf,
Intel, Portland group, ...) and it does not pass with any of them but
gfortran. I do not have the time and patience to go through the standard
to see what is allowed and not in namelist. If I replace the writes by
write (10, '(A)') "&MYNML"
write (10, '(A)') " x = 3, 4, 'dd', 'ee', 'ff', 'gg',"
write (10, '(A)') " 4, 5, 'hh', 'ii', 'jj', 'kk',"
write (10, '(A)') " x(2)%i = -3, -4"
write (10, '(A)') " x(2)%m(1)%ch(2) ='q',"
write (10, '(A)') " x(2)%m(2)%ch(1)(1:1) ='w',"
write (10, '(A)') " x(1)%m(1)%ch(:)(2:2) = 'z','z',"
write (10, '(A)') " x(1)%m(2)%ch(:)(2:2) = 'z','z',"
write (10, '(A)') " x(2)%m(1)%ch(:)(2:2) = 'z','z',"
write (10, '(A)') " x(2)%m(2)%ch(:)(2:2) = 'z','z',"
write (10, '(A)') "&end"
it works with xlf (second read only) and Intel Fortran (I get a bus error
with the Portland group fortran and a wrong result with g95). My (very
limited) understanding of derived types is that constructs such as
'x%i' or 'x%m%ch(:)' are forbidden in expressions according the rule:
"Only one part of the structure component may have nonzero rank. Either
the rightmost comp_name must have a section_subscript_list with nonzero
rank, or another part must have nonzero rank." (IBM manual)
In addition character substrings must be of the type
'x(2)%m(2)%ch(1)(1:1)' and not 'x(2)%m(2)%ch(1)(1)' (unless I am mistaken).
So it seems that most compilers apply to namelists the same constraints as
in the expressions.
Happy holiday time to everybody.
Dominique