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

            Bug ID: 82375
           Summary: PDT error
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ian at rhymneyconsulting dot co.uk
  Target Milestone: ---

Created attachment 42267
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42267&action=edit
these are the three source files. the main program and two included module
files.

I believe that the following program is standard conformant and that the
gfortran compilation error message is incorrect. Here is the main program
source file. 

include 'precision_module.f90'
include 'ch2701_link_module.f90'

program ch2701
  use precision_module
  use link_module
  implicit none
  integer, parameter :: wp = dp
  type (link(real_kind=wp)), pointer :: root, &
    current
  integer :: i = 0
  integer :: error = 0
  integer :: io_stat_number = 0
  real (wp), allocatable, dimension (:) :: x

  allocate (root)
  print *, ' type in some numbers'
  read (unit=*, fmt=*, iostat=io_stat_number) &
    root%n
  if (io_stat_number>0) then
    error = error + 1
  else if (io_stat_number<0) then
    nullify (root%next)
  else
    i = i + 1
    allocate (root%next)
  end if
  current => root
  do while (associated(current%next))
    current => current%next
    read (unit=*, fmt=*, iostat=io_stat_number) &
      current%n
    if (io_stat_number>0) then
      error = error + 1
    else if (io_stat_number<0) then
      nullify (current%next)
    else
      i = i + 1
      allocate (current%next)
    end if
  end do
  print *, i, ' items read'
  print *, error, ' items in error'
  allocate (x(1:i))
  i = 1
  current => root
  do while (associated(current%next))
    x(i) = current%n
    i = i + 1
    print *, current%n
    current => current%next
  end do
  print *, x
end program ch2701

I have attached the three source files, ch2701.f90, precision_module.f90 and
ch2701_link_module.f90. here is the error message. 

c:\document\fortran\fourth_edition\examples>gfortran -v ch2701.f90
Driving: gfortran -v ch2701.f90 -l gfortran
Built by Equation Solution <http://www.Equation.com>.
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=c:/gcc/bin/../libexec/gcc/x86_64-w64-mingw32/8.0.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../gcc-8-20170917-mingw/configure --host=x86_64-w64-mingw32
--build=x86_64-unknown-linux-gnu --target=x86_64-w64-mingw32
--prefix=/home/gfortran/gcc-home/binary/mingw32/native/x86_64/gcc/8-20170917
--with-sysroot=/home/gfortran/gcc-home/binary/mingw32/cross/x86_64/gcc/8-20170709
--with-gcc --with-gnu-ld --with-gnu-as --with-ld64=no
--with-gmp=/home/gfortran/gcc-home/binary/mingw32/native/x86_64/gmp
--with-mpfr=/home/gfortran/gcc-home/binary/mingw32/native/x86_64/mpfr
--with-mpc=/home/gfortran/gcc-home/binary/mingw32/native/x86_64/mpc
--with-cloog=/home/gfortran/gcc-home/binary/mingw32/native/x86_64/cloog
--with-diagnostics-color=auto-if-env --enable-cloog-backend=isl
--enable-targets=i686-w64-mingw32,x86_64-w64-mingw32 --enable-lto
--enable-languages=c,c++,fortran --enable-threads=win32 --enable-static
--enable-shared=lto-plugin --enable-plugins --enable-ld=yes
--enable-libquadmath --enable-libquadmath-support --enable-libgomp
--disable-checking --disable-nls --disable-tls --disable-win32-registry
Thread model: win32
gcc version 8.0.0 20170917 (experimental) (GCC)
COLLECT_GCC_OPTIONS='-v' '-mtune=generic' '-march=x86-64'
 c:/gcc/bin/../libexec/gcc/x86_64-w64-mingw32/8.0.0/f951.exe ch2701.f90 -quiet
-dumpbase ch2701.f90 -mtune=generic -march=x86-64 -auxbase ch2701 -version
-fintrinsic-modules-path
c:/gcc/bin/../lib/gcc/x86_64-w64-mingw32/8.0.0/finclude -o
C:\Users\ian\AppData\Local\Temp\cc8gUhjd.s
GNU Fortran (GCC) version 8.0.0 20170917 (experimental) (x86_64-w64-mingw32)
        compiled by GNU C version 8.0.0 20170709 (experimental), GMP version
6.1.0, MPFR version 3.1.4, MPC version 1.0.3, isl version none
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU Fortran2008 (GCC) version 8.0.0 20170917 (experimental)
(x86_64-w64-mingw32)
        compiled by GNU C version 8.0.0 20170709 (experimental), GMP version
6.1.0, MPFR version 3.1.4, MPC version 1.0.3, isl version none
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ch2701.f90:9:27:

   type (link(real_kind=wp)), pointer :: root, &
                           1
Error: The derived parameter ''real_kind'' at (1) does not have a default value
ch2701.f90:16:12:

   allocate (root)
            1
Error: Allocate-object at (1) is neither a data pointer nor an allocatable
variable
ch2701.f90:19:9:

     root%n
         1
Error: Symbol 'root' at (1) has no IMPLICIT type
ch2701.f90:23:18:

     nullify (root%next)
                  1
Error: Symbol 'root' at (1) has no IMPLICIT type
ch2701.f90:26:19:

     allocate (root%next)
                   1
Error: Symbol 'root' at (1) has no IMPLICIT type
ch2701.f90:29:31:

   do while (associated(current%next))
                               1
Error: Symbol 'current' at (1) has no IMPLICIT type
ch2701.f90:30:23:

     current => current%next
                       1
Error: Symbol 'current' at (1) has no IMPLICIT type
ch2701.f90:32:14:

       current%n
              1
Error: Symbol 'current' at (1) has no IMPLICIT type
ch2701.f90:36:23:

       nullify (current%next)
                       1
Error: Symbol 'current' at (1) has no IMPLICIT type
ch2701.f90:39:24:

       allocate (current%next)
                        1
Error: Symbol 'current' at (1) has no IMPLICIT type
ch2701.f90:41:5:

   end do
     1
Error: Expecting END PROGRAM statement at (1)
ch2701.f90:47:31:

   do while (associated(current%next))
                               1
Error: Symbol 'current' at (1) has no IMPLICIT type
ch2701.f90:48:19:

     x(i) = current%n
                   1
Error: Symbol 'current' at (1) has no IMPLICIT type
ch2701.f90:50:21:

     print *, current%n
                     1
Error: Symbol 'current' at (1) has no IMPLICIT type
ch2701.f90:51:23:

     current => current%next
                       1
Error: Symbol 'current' at (1) has no IMPLICIT type
ch2701.f90:52:5:

   end do
     1
Error: Expecting END PROGRAM statement at (1)
ch2701.f90:28:9:

   current => root
         1
Error: Symbol 'current' at (1) has no IMPLICIT type
ch2701.f90:28:17:

   current => root
                 1
Error: Symbol 'root' at (1) has no IMPLICIT type

c:\document\fortran\fourth_edition\examples>

I was talking to Paul Thomas at the BCS Fortran AGM yesterday and he asked me
to submit the problem I was having with PDTs.

Reply via email to