Quantcast
Channel: Intel® Fortran Compiler for Linux* and macOS*
Viewing all articles
Browse latest Browse all 2583

Segmentation fault when coarray attribute omitted for the dummy argument

$
0
0

Hi,

The following code gives a segmentation fault.

This error is triggered when I call a procedure (ProceVersion2) passing a coarray actual argument but the associated dummy argument has NOT the coarray attribute.

If the same procedure is written with the coarray attribute for the dummy argument (ProceVersion1), then there is no error.

Surprisingly, if both procedures are called, there is also no error.

Also, if the allocatable attribute is removed, there is no error

Thanks for looking at this issue.

Program Main
  integer ,allocatable ,codimension[:]  ::    coVar
!   integer  ,codimension[*]  ::    coVar
  allocate( coVar[*] )
!   call ProceVersion1( coVar )
  call ProceVersion2( coVar )
contains
  Subroutine ProceVersion1( Variable  )
    class(*) ,intent(in)     ::      Variable[*]
    write(6,"(4x,'[ProceVersion1]: Entering')")
    select type (Variable)
      type is (integer);      write(6,"(4x,'[ProceVersion1]: integer')")
      class default;          write(6,"(4x,'[ProceVersion1]: other')")
    end select
  End Subroutine
  Subroutine ProceVersion2( Variable  )
    class(*) ,intent(in)     ::      Variable
    write(6,"(4x,'[ProceVersion2]: Entering')")
    select type (Variable)
      type is (integer);      write(6,"(4x,'[ProceVersion2]: integer')")
      class default;          write(6,"(4x,'[ProceVersion2]: other')")
    end select
  End Subroutine
End Program


! export FOR_COARRAY_NUM_IMAGES=1; ifort -coarray -coarray-num-images=1 -O0 -pg -warn all -traceback  main.f90; ./a.out

 


Viewing all articles
Browse latest Browse all 2583

Trending Articles



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