Quantcast
Channel: Intel® Fortran Compiler
Viewing all articles
Browse latest Browse all 3270

ICE: ifort-16.0 with -assume realloc-lhs

$
0
0

I recently upgraded to ifort 16.0 from ifort 15.0.3 for OS X and have encountered an ICE and also an unexpected segmentation fault. 

I experience the ICE when I have two derived types. The first is a component of the second. The first has an empty finalization procedure, which seems to cause the ICE. Both types have overloaded operators. 

module subtype
      implicit none

      type, public :: subtype_t

          real :: val

      contains
          final :: destructor
      end type subtype_t


      public operator (*)
      interface operator (*)
        module procedure op
      end interface


contains

      elemental function op(left,right) result(res)
          real,               intent(in)  :: left
          type(subtype_t),    intent(in)  :: right
          type(subtype_t) :: res

          res%val = left * right%val

      end function

      subroutine destructor(self)
          type(subtype_t),    intent(inout)   :: self

      end subroutine

end module

The above subtype_t is a component of a second derived type of similar structure as

module type
      use subtype
      implicit none

      type, public :: type_t

          type(subtype_t),    allocatable :: lvecs(:)

      end type type_t

      public operator (*)
      interface operator (*)
          module procedure op_two
      end interface


contains


     function op_two(left,right) result(res)
         real,               intent(in)  :: left
         type(type_t),       intent(in)  :: right
         type(type_t)    :: res

         res%lvecs = left * right%lvecs

     end function

end module

Trying to compile the above modules with ifort-16.0 -c -assume realloc-lhs produces an ICE. If the finalization procedure is commented out in subtype_t the code compiles without error. ifort-15.0.3 compiles in either case without error.

Assuming the finalization procedure has been commented out and the modules compile, I experience a run-time segmentation fault when testing the multiplication operator with ifort-16.0 using -assume realloc-lhs. 

program main
    use type
    implicit none

    type(type_t)    :: testing, res


    ! Allocate derived type component
    allocate(testing%lvecs(1))

    ! Assign values
    testing%lvecs(1)%val = 1.


    ! Test multiplication operation
    ! Seg-fault with ifort 16.0 using -assume realloc-lhs
    ! Executes without error using ifort 15.0.3
    res = 1. * testing


end program main

Source files are attached.

AttachmentSize
Downloadsubtype.f901.04 KB
Downloadtype.f90638 bytes
Downloadmain.f90419 bytes

Viewing all articles
Browse latest Browse all 3270

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>