Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

openMP + polymorphism (ifort 19.1 on Linux)

Ferdinand_T_
New Contributor II
473 Views

Dear all,

if I remember correctly, mixing Fortran 2003 polymorphism and openMP was not fully supported in the past (is this still the case?).

However, some functionality apparently degraded with ifort 19.1 (compared to previous versions, at least from ifort 17 upwards). Here is a snipped that no longer works in ifort 19.1.0 for Linux:

program test
    implicit none

    type :: t
    end type

    class(t), allocatable :: x
    allocate(x)

    !$OMP parallel
    select type(x)
    class default
    end select
    !$OMP end parallel
end program

Here is some exemplary output (e.g. with export OMP_NUM_THREADS=1); but the crash is not deterministic and manifests only sporadically:

$ ifort test.f90 -qopenmp -trace
$ ./a.out
forrtl: severe (174): SIGSEGV, segmentation fault occurred
Image              PC                Routine            Line        Source        
a.out              0000000000404E4A  Unknown               Unknown  Unknown
libpthread-2.17.s  00002B6CC94D6630  Unknown               Unknown  Unknown
a.out              000000000041DDB8  Unknown               Unknown  Unknown
a.out              0000000000403EB7  MAIN__                     10  test.f90

I would appreciate your input on whether this code is supposed to work, and whether I should consider filing a bug report with Intel.
Also, suggestions on fixes that make this type-selection work in an openMP-clause are appreciated.

Kind regards
Ferdinand

0 Kudos
2 Replies
Barbara_P_Intel
Moderator
473 Views

I checked with an Intel representative to the OpenMP standards committee. OpenMP 5.0 supports this use of polymorphic entities. OpenMP 4.5 does not define how they work together.

I filed a bug (moth?) for this, CMPLRIL0-32771.

 

0 Kudos
Ferdinand_T_
New Contributor II
473 Views

Barbara,

Thank you!

0 Kudos
Reply