Bug with pointer to component of allocated type

Bug with pointer to component of allocated type

I believe I finally found a nasty compiler bug. Starting with compiler version intel/2017.5.239 up to the most recent avaiable for me intel/2019.0.117, there is a problem with pointing to a component of an allocated derived type. Opposing to the expectation using the pointer modifies always the first component of type instead of the one that it is pointing to. The following minimal reproducer compiled with -O0 returns:

 F F

In the example it is only output, however, it works also wrong for modifying, even with the type components have different POD types. The intel compiler 2016 and earlier shows the expected behavoir.


  TYPE t_traj
    LOGICAL :: a = .FALSE.
    LOGICAL :: b = .TRUE.
  END TYPE t_traj

  INTEGER, PARAMETER :: noPart = 3
  TYPE(t_traj), TARGET, ALLOCATABLE :: sps(:)
  LOGICAL, POINTER :: p_point(:)
  ALLOCATE( sps(noPart) )

  p_point(1:noPart-1) => sps(1:noPart-1)%b
  WRITE(*,*) p_point



publicaciones de 2 / 0 nuevos
Último envío
Para obtener más información sobre las optimizaciones del compilador, consulte el aviso sobre la optimización.

This indeed looks like a compiler bug. Please submit it through the Online Support Center.

Deje un comentario

Por favor inicie sesión para agregar un comentario. ¿No es socio? Únase ya