This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/47569] New: gfortran does not detect that the parameters for passing a partial string to a subroutine are incorrect.
- From: "kloedej at knmi dot nl" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 1 Feb 2011 10:40:33 +0000
- Subject: [Bug fortran/47569] New: gfortran does not detect that the parameters for passing a partial string to a subroutine are incorrect.
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47569
Summary: gfortran does not detect that the parameters for
passing a partial string to a subroutine are
incorrect.
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: kloedej@knmi.nl
gfortran does not detect that the parameters for passing a partial string to a
subroutine are incorrect.
The example uses s(i) in stead of s(i:j) to pass the string, and this was a
common usage pattern in the old fortran77 days, so this may bother more users.
Sample code:
module teststr
implicit none
integer, parameter :: GRH_SIZE = 20, NMAX = 41624
type strtype
integer :: size
character :: mdr(NMAX)
end type strtype
contains
subroutine sub2(string,str_size)
integer,intent(in) :: str_size
character,intent(out) :: string(str_size)
string(:) = 'a'
end subroutine sub2
subroutine sub1(a)
type(strtype),intent(inout) :: a
call sub2(a%mdr(GRH_SIZE+1),a%size-GRH_SIZE)
end subroutine sub1
end module teststr
Command used for compiling:
>gfortran -c minimal_example.F90
f951: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugzilla.redhat.com/bugzilla> for instructions.
>
gfortran version used:
>gfortran --version
GNU Fortran (GCC) 4.4.4 20100630 (Red Hat 4.4.4-10)
If the line:
call sub2(a%mdr(GRH_SIZE+1),a%size-GRH_SIZE)
is replaced by:
call sub2(a%mdr(GRH_SIZE+1:),a%size-GRH_SIZE)
then the compilation runs without problems.
Expected output was to get a proper error message with the provided sample
code.