Structure constructors for extended types

Structure constructors for extended types

Imagen de IanH

I think structure constructors that include a parent component can confuse the current release of the compiler.

MODULE m20130816
  TYPE :: Parent
    LOGICAL :: l
    INTEGER, ALLOCATABLE :: array(:)
  END TYPE Parent
  TYPE, EXTENDS(Parent) :: Extension
    REAL :: b
    REAL :: c
  END TYPE Extension
END MODULE m20130816
PROGRAM ExtensionStructureConstructor
  USE m20130816
  TYPE(Parent) :: p_scalar
  TYPE(Parent) :: p_array(2)
  TYPE(Extension) :: e
  p_scalar = Parent(.FALSE., [1, 2, 3])
  ! This one is ok.
  e = Extension(PARENT=p_scalar, B=2.0, C=3.0)
  p_array(1) = Parent(.FALSE., [1, 2, 3])
  ! This one gives error #8212.
  e = Extension(PARENT=p_array(1), B=2.0, C=3.0)
END PROGRAM ExtensionStructureConstructor

>ifort /c /check:all /warn:all /standard-semantics ExtensionStructureConstructor.f90
Intel(R) Visual Fortran Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version Build 20130607
Copyright (C) 1985-2013 Intel Corporation.  All rights reserved.
ExtensionStructureConstructor.f90(26): error #8212: Omitted field is not initialized. Field initialization missing:   [L]
  e = Extension(PARENT=p_array(1), B=2.0, C=3.0)
compilation aborted for ExtensionStructureConstructor.f90 (code 1)

I think the error message is exhorting me to break F2008 C491.  But me mum told me not to do that, or I'd get into big trouble.

publicaciones de 4 / 0 nuevos
Último envío
Para obtener más información sobre las optimizaciones del compilador, consulte el aviso sobre la optimización.
Imagen de Steve Lionel (Intel)

I know we've had problems like this in the past, but I still see the error here in our latest compiler. Let me look at it in more detail.

Imagen de Steve Lionel (Intel)

Ian, thanks for the nice example. Escalated as issue DPD200247227.

Imagen de Steve Lionel (Intel)

This bug has been fixed - I expect the fix to appear in the October update.


Inicie sesión para dejar un comentario.