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

Substrings of character components of extension types

IanH
Honored Contributor III
908 Views

If an object with a character array component is of a type that extends another type, then attempts to substring the character component result in strange errors.

MODULE m
  IMPLICIT NONE
  TYPE :: Parent
  END TYPE Parent
  TYPE, EXTENDS(Parent) :: Extension
    CHARACTER(10) :: component(5)
  END TYPE Extension
CONTAINS
  SUBROUTINE s(arg)
    CLASS(Extension), INTENT(IN) :: arg
    PRINT *, arg%component(2)(1:3)
  END SUBROUTINE s
END MODULE m

 

>ifort /c /check:all /warn:all /standard-semantics "2014-09-02 character-component.f90"
Intel(R) Visual Fortran Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 15.0.0.108 Build 20140726
Copyright (C) 1985-2014 Intel Corporation.  All rights reserved.

2014-09-02 character-component.f90(11): error #6460: This is not a field name that is defined in the encompassing struct
ure.   [COMPONENT]
    PRINT *, arg%component(2)(1:3)
-----------------^
2014-09-02 character-component.f90(11): error #6514: A substring must be of type CHARACTER.   [COMPONENT]
    PRINT *, arg%component(2)(1:3)
-----------------^
2014-09-02 character-component.f90(11): error #6158: The structure-name is invalid or is missing.   [ARG]
    PRINT *, arg%component(2)(1:3)
-------------^
compilation aborted for 2014-09-02 character-component.f90 (code 1)

 

0 Kudos
1 Reply
Steven_L_Intel1
Employee
908 Views

Weird.  Escalated as DPD200360549.

0 Kudos
Reply