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

Bug in associate polymorphic type in omp parallel do loop

Daan_v_
Beginner
378 Views

The code below segfaults in ifort 17.0.4 unless I remove the associate lines. The address of `this` passed to `write_i` is 0xccccccccc

 

program associate_pass
type :: t
  integer :: i = 1
end type

integer :: i
class(t), dimension(:), allocatable :: a ! class(t) is important

allocate(a(100))

!$omp parallel do default(private) shared(a)
do i=1,size(a,1)
  associate (p => a(i)) ! remove this line to 'fix'
  call write_i(p)
  end associate ! remove this one also
end do
!$omp end parallel do

contains
subroutine write_i(this)
  class(t) :: this
  write(*,*) this%i
end subroutine write_i
end program associate_pass

 

Compilation line is

mpiifort -mt_mpi -qopenmp -O0 -g -traceback -ftrapuv -debug all -debug-parameters -fstack-security-check -i4 -diag-disable 5462    -align -warn all -warn nointerfaces -warn nounused -fpp -r8 -check all,noarg_temp_created -check bounds -check uninit -init=snan -init=zero -init=arrays -gen-interfaces -warn-interfaces -implicitnone associate_pass.f90 -o associate_pass

but I doubt anything except -qopenmp is of importance there.

0 Kudos
3 Replies
Steve_Lionel
Honored Contributor III
378 Views

Quoting the OpenMP standard:

This OpenMP API specification refers to ISO/IEC 1539-1:2004 as Fortran 2003. The
following features are not supported:
• IEEE Arithmetic issues covered in Fortran 2003 Section 14
• Allocatable enhancement
• Parameterized derived types
• Finalization
• Procedures bound by name to a type
• The PASS attribute
• Procedures bound to a type as operators
• Type extension
• Overriding a type-bound procedure
• Polymorphic entities
• SELECT TYPE construct
• Deferred bindings and abstract types
• Controlling IEEE underflow
• Another IEEE class value 

Now it could be that the compiler does the right thing anyway in many cases, but not here. I'd suggest reporting this through the Intel Online Service Center to get it on record.

0 Kudos
Daan_v_
Beginner
378 Views

Thanks Steve! I'm very happy at least part of that list is unofficially supported.

0 Kudos
singh__rahul
Beginner
378 Views

How to solve this error while mpirun

forrtl: severe (174): SIGSEGV, segmentation fault occurred
Image              PC                Routine            Line        Source             
libintlc.so.5      00002B230B2D9BD5  Unknown               Unknown  Unknown
libintlc.so.5      00002B230B2D77F7  Unknown               Unknown  Unknown
libifcore.so.5     00002B2309C885D2  Unknown               Unknown  Unknown
libifcore.so.5     00002B2309C88426  Unknown               Unknown  Unknown
libifcore.so.5     00002B2309BE15F5  Unknown               Unknown  Unknown
libifcore.so.5     00002B2309BF343D  Unknown               Unknown  Unknown
libpthread.so.0    000000340CE0F790  Unknown               Unknown  Unknown
run3               000000000040270A  Unknown               Unknown  Unknown
run3               0000000000401F9E  Unknown               Unknown  Unknown
run3               0000000000401F4E  Unknown               Unknown  Unknown
libc.so.6          000000340C61ED5D  Unknown               Unknown  Unknown
run3               0000000000401E59  Unknown               Unknown  Unknown
forrtl: severe (174): SIGSEGV, segmentation fault occurred
Image              PC                Routine            Line        Source             
libintlc.so.5      00002AFCEB787BD5  Unknown               Unknown  Unknown
libintlc.so.5      00002AFCEB7857F7  Unknown               Unknown  Unknown
libifcore.so.5     00002AFCEA1365D2  Unknown               Unknown  Unknown
libifcore.so.5     00002AFCEA136426  Unknown               Unknown  Unknown
libifcore.so.5     00002AFCEA08F5F5  Unknown               Unknown  Unknown
libifcore.so.5     00002AFCEA0A143D  Unknown               Unknown  Unknown
libpthread.so.0    000000340CE0F790  Unknown               Unknown  Unknown
run3               000000000040270A  Unknown               Unknown  Unknown
run3               0000000000401F9E  Unknown               Unknown  Unknown
run3               0000000000401F4E  Unknown               Unknown  Unknown
libc.so.6          000000340C61ED5D  Unknown               Unknown  Unknown
run3               0000000000401E59  Unknown               Unknown  Unknown

 

0 Kudos
Reply