[Patch, Fortran, Doc] Document type-bound operators

Paul Richard Thomas paul.richard.thomas@gmail.com
Sat Aug 29 18:15:00 GMT 2009


Dear Tobias,

> I was investigating the implementation of simple OOP programmes, such as:

So simple as to be wrong, since the results did not comply in TKR!

Before I report back to Intel, can anybody see what is wrong with:

module m
  type :: t1
    integer :: i = 42
  contains
    procedure, pass :: prod => i_m_j
  end type t1
  type, extends(t1) :: t2
    integer :: j = 99
  end type t2
contains
  integer function i_m_j (arg)
    class(t1), intent(in) :: arg
    select type (arg)
      type is (t1)
        i_m_j = 0
      class is (t2)
        i_m_j = 1
      class default
        print *, "should not be here"
    end select
  end function i_m_j
end module m

  use m
  class(t1), pointer :: a
  type(t1), target :: b
  type(t2), target :: c
  a => b
  print *, a%prod()
  a => c
  print *, a%prod()
end

It compiles OK but gives;
           0
forrtl: severe (174): SIGSEGV, segmentation fault occurred
Image              PC                Routine            Line
Source
a.out              0000000000402BEE  Unknown               Unknown  Unknown
a.out              0000000000402ADC  Unknown               Unknown  Unknown
libc.so.6          0000003A2861E32A  Unknown               Unknown  Unknown
a.out              00000000004029D9  Unknown               Unknown  Unknown

I think that I have a glibc version problem but would be pleased if
somebody would give a thumbs-up on the fortran.

Cheers

Paul



More information about the Fortran mailing list