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

ICE with optional argument, overriden LEN and allocation of deferred length character

IanH
Honored Contributor II
172 Views

T.G.I.F.

MODULE iso_varying_internal_compiler_error
  IMPLICIT NONE
  
  TYPE, PUBLIC :: varying_string
    CHARACTER(:), ALLOCATABLE, PUBLIC :: chars
  END TYPE varying_string
  
  INTERFACE len
    MODULE PROCEDURE len_
  END INTERFACE len
CONTAINS
  ELEMENTAL FUNCTION len_(string) RESULT(length)
    TYPE(varying_string), INTENT(IN) :: string
    INTEGER :: length
    !***************************************************************************
    IF (ALLOCATED(string%chars)) THEN
       length = LEN(string%chars)
    ELSE
       length = 0
    END IF
  END FUNCTION len_
  
  SUBROUTINE get_unit(iomsg)
    CHARACTER(*), INTENT(INOUT), OPTIONAL :: iomsg
    !---------------------------------------------------------------------------
    CHARACTER(:), ALLOCATABLE :: local_iomsg
    !***************************************************************************
    IF (PRESENT(iomsg)) THEN
      ALLOCATE(CHARACTER(LEN(iomsg)) :: local_iomsg)
    ELSE
      ALLOCATE(CHARACTER(1) :: local_iomsg)
    END IF
  END SUBROUTINE get_unit
END MODULE iso_varying_internal_compiler_error

 

>ifort /check:all /warn:all /standard-semantics "2016-03-18 optional_length.f90"
Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 16.0 Build 20160204
Copyright (C) 1985-2016 Intel Corporation.  All rights reserved.

2016-03-18 optional_length.f90(30): catastrophic error: **Internal compiler error: internal abort** Please report this e
rror along with the circumstances in which it occurred in a Software Problem Report.  Note: File and line given may not
be explicit cause of this error.
compilation aborted for 2016-03-18 optional_length.f90 (code 1)

To the fridge!

0 Kudos
3 Replies
Steven_L_Intel1
Employee
172 Views

Thanks - we'll check it out.

0 Kudos
Steven_L_Intel1
Employee
172 Views

Escalated as issue DPD200408435. The OPTIONAL aspect doesn't matter, nor do the compile options.

0 Kudos
Steven_L_Intel1
Employee
172 Views

This was fixed in 17.0, but I didn't find out about that until now. Probably also one of the later 16.0 updates.

0 Kudos
Reply