Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
7 Views

ifort 16.0.3 bug with unlimited polymorphism

Jump to solution

Dear Intel support team

For the following code I obtain an error:

program test
  implicit none
  type SomeType
    real, pointer, contiguous :: x(:) => null()
  end type
  type(SomeType) :: t

  allocate(t%x(10))
  call doSomething(t)
  write(*,*) t%x
contains

  subroutine doSomething(myT)
    class(*), intent(in) :: myT

    select type(myT)
    type is (SomeType)
      ! not allowed!
      ! myT%x => null()

      ! allowed!
      myT%x = 7.

      ! workaround
      call assign7(myT%x)

    class default
      write(*,*) 'error'
      call exit(1)
    end select

  end subroutine

  subroutine assign7(x)
    real, intent(out) :: x(:)
    x = 7
  end subroutine

end program test

The error message shown is:

> ifort --version
ifort (IFORT) 16.0.3 20160415
> ifort test.f90 
test.f90(22): error #6780: A dummy argument with the INTENT(IN) attribute shall not be defined nor become undefined.   [MYT]
      myT%x = 7.
------^
compilation aborted for test.f90 (code 1)

As x is a pointer changing its value should be allowed though. Everything works fine, when "myT" is just declared as "type(SomeType), intent(in)" (without using "class(*)" polymorphism)!

As a workaround it is possible to call a subroutine to modify "myT%x"...

Regards

Melven

0 Kudos

Accepted Solutions
Highlighted
7 Views

Thanks for reporting the

Jump to solution

Thanks for reporting the error. It no longer happens with 17.0 compiler which will be released very soon.

 

Thanks,

Xiaoping Duan

Intel Customer Support

View solution in original post

0 Kudos
1 Reply
Highlighted
8 Views

Thanks for reporting the

Jump to solution

Thanks for reporting the error. It no longer happens with 17.0 compiler which will be released very soon.

 

Thanks,

Xiaoping Duan

Intel Customer Support

View solution in original post

0 Kudos