public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/47569] New: gfortran does not detect that the parameters for passing a partial string to a subroutine are incorrect.
@ 2011-02-01 10:40 kloedej at knmi dot nl
  2011-02-01 11:04 ` [Bug fortran/47569] [4.3/4.4/4.5/4.6 Regression] " burnus at gcc dot gnu.org
                   ` (17 more replies)
  0 siblings, 18 replies; 19+ messages in thread
From: kloedej at knmi dot nl @ 2011-02-01 10:40 UTC (permalink / raw)
  To: gcc-bugs

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.


^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2011-02-14 14:12 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-01 10:40 [Bug fortran/47569] New: gfortran does not detect that the parameters for passing a partial string to a subroutine are incorrect kloedej at knmi dot nl
2011-02-01 11:04 ` [Bug fortran/47569] [4.3/4.4/4.5/4.6 Regression] " burnus at gcc dot gnu.org
2011-02-01 11:33 ` burnus at gcc dot gnu.org
2011-02-01 14:54 ` burnus at gcc dot gnu.org
2011-02-01 15:19 ` burnus at gcc dot gnu.org
2011-02-03  5:27 ` pault at gcc dot gnu.org
2011-02-03  7:46 ` burnus at gcc dot gnu.org
2011-02-10 15:14 ` burnus at gcc dot gnu.org
2011-02-10 15:21 ` burnus at gcc dot gnu.org
2011-02-12  1:38 ` burnus at gcc dot gnu.org
2011-02-12 19:24 ` dominiq at lps dot ens.fr
2011-02-12 19:28 ` burnus at gcc dot gnu.org
2011-02-13 10:14 ` burnus at gcc dot gnu.org
2011-02-13 19:30 ` burnus at gcc dot gnu.org
2011-02-13 21:01 ` [Bug fortran/47569] [4.3/4.4/4.5 " burnus at gcc dot gnu.org
2011-02-14  8:04 ` burnus at gcc dot gnu.org
2011-02-14 14:07 ` [Bug fortran/47569] [4.3/4.4 " burnus at gcc dot gnu.org
2011-02-14 14:12 ` [Bug fortran/47569] [4.3/4.4/4.5/4.6 " burnus at gcc dot gnu.org
2011-02-14 14:13 ` kloedej at knmi dot nl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).