This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Error gfortran 8 derived type-bound procedure PASS(this)


The test program below works in Intel Fortran for Windows. It works in gfortran until we added the n to the typedef as a length. I built gfortran 8 from svn last night using Cygwin to test this. Please tell me what I’m doing wrong?

I enjoyed looking through all the test cases. Anyone that names a folder testsuite/fortran-torture gets my vote as the best Klingon tester. I found some tests with NOPASS and PASS(self) but non with a length argument as far as I could tell grepping through the code.

While I’m not qualified to change the compiler code, I’d be happy to help with the docs. The blog below on how to build needs to be updated and moved into the official docs. We’ve enjoyed using Photran with Eclipse PTP. The refactoring is superior to Microsoft Visual Studio IMHO.
 
http://preshing.com/20141108/how-to-install-the-latest-gcc-on-windows/ <http://preshing.com/20141108/how-to-install-the-latest-gcc-on-windows/>
 
https://gcc.gnu.org/svn.html <https://gcc.gnu.org/svn.html>
 
! Test derived type type-bound procedure object oriented module.
! polymorphic class
! gfortran-8.0.0 -mcmodel=large -fcheck=all -fbacktrace -Wall -g3 -ggdb -c test.f90
! test.f90:12:15:
! Error: Argument 'this' of 'foo' with PASS(this) at (1) must be of the derived-type 'typedef'
module testmod
   public :: foo
   type, public :: typedef(n) ! n causes trouble here--works without it
      integer, len :: n = 1
      integer, dimension(n) :: x
   contains
      procedure :: foo ! pass(this) vs nopass—this is where the error is
   end type typedef
 
contains
   subroutine foo(this)
      class(typedef(n=*)), intent(INOUT) :: this ! this is the real trouble we tried (n=*) and (*) works in Intel Fortran
      integer i
      do i = 1, this%x(1)
         print *, i, this%x, 'foo'
      end do
   end subroutine foo
end module testmod
 
program main
   use testmod
   type(typedef(2)) b
   b%x = [3, 1]
   call b%foo()
   print *,'hello'
end program main

Bug 82943 <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82943> - Error derived type-bound procedure PASS(this) 

—Darrell
San Diego, CA, USA



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]