https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83731

            Bug ID: 83731
           Summary: PDT length parameter incorrectly rejected at run-time
                    with -fcheck=bounds
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: berke.durak at gmail dot com
  Target Milestone: ---

Using the nightly 20180107 trunk rev. 256317:

% cat pdt.f90

module pdt_m
  implicit none
  type :: vec(k)
     integer, len :: k=10
     integer :: foo(k)
  end type vec
contains
  function total(a)
    type(vec(k=*)), intent(in) :: a
    integer :: total

    total=sum(a%foo)
  end function total
end module pdt_m

program test_pdt
  use pdt_m
  implicit none
  type(vec(k=123)) :: u

  u%foo=1
  print *,'total=',total(u)
end program test_pdt

% /usr/local/gfortran-bin/bin/gfortran pdt.f90 -fcheck=bounds -g -O0 -o pdt
-Wall -Wextra
% LD_LIBRARY_PATH=/usr/local/gfortran-bin/lib64:$LD_LIBRARY_PATH ./pdt 
In file 'pdt.f90', around line 14                                     
Fortran runtime error: The value of the PDT LEN parameter 'k' does not agree
with that in the dummy declaration

Error termination. Backtrace:
#0  0x40096a in __pdt_m_MOD_total
        at /home/alpha/src/fortran/23_Parametrized_derived_types/pdt.f90:13
#1  0x400c45 in test_pdt
        at /home/alpha/src/fortran/23_Parametrized_derived_types/pdt.f90:22
#2  0x400cce in main
        at /home/alpha/src/fortran/23_Parametrized_derived_types/pdt.f90:17

GNU Fortran (GCC) 8.0.0 20180107 (experimental) [trunk revision 256317]
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Reply via email to