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

automatic coarray object with Intel Fortran

DataScientist
Valued Contributor I
165 Views

The Fortran standard, as far as I am aware, prohibits the use of automatic coarrays. However, I have noticed that Intel Fortran compiler 2018, allows such automatic object creations. For example, ifort happily compiles the following code in the debug mode and the code works totally fine:

program testAutoCoarray

implicit none

integer :: i
integer, parameter :: nd=10

call createAutoCoarray(nd)

end program testAutoCoarray

subroutine createAutoCoarray(nd)
  implicit none
  integer, intent(in) :: nd
  real, save :: AutoCoarray(nd)
  • if (this_image()==1) then AutoCoarray = -13.e0 sync images(*) else AutoCoarray = AutoCoarray(:)[1] sync images(1) end if write(*,"(*(g0.4,' '))") this_image(), AutoCoarray end subroutine createAutoCoarray
  • Have I understood the Fortran 2008 standard incorrectly, or this is a bug in ifort. It is notable that ifort crashes with catastrophic internal error if I attempt to compile the same code as above in O2 or O3 modes. Here is the message:

    E:\testAutomaticCoarray>ifort /O2 /Qcoarray=shared /standard-semantics /assume:realloc_lhs main.f90 -o run.exe
    Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 18.0.1.156 Build 20171018
    Copyright (C) 1985-2017 Intel Corporation.  All rights reserved.
    
    0_8000
    
    E:\testAutomaticCoarray\main.f90(12): catastrophic error: **Internal compiler error: internal abort** Please report this error 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 main.f90 (code 1)

    Thank you for your help and great work!

    0 Kudos
    1 Solution
    Steve_Lionel
    Black Belt Retired Employee
    165 Views

    The compiler should never have allowed this. AutoCoarray can't be automatic, because it has the SAVE attribute. But then it has a specification expression for bounds, which makes it automatic.

    There is no explicit prohibition of an "automatic coarray", but the requirement that a coarray be "an associate name, a dummy argument, or have the ALLOCATABLE or SAVE attribute" effectively eliminates that possibility.

    Please report this bug to Intel at https://supporttickets.intel.com/?lang=en-US

    View solution in original post

    2 Replies
    Steve_Lionel
    Black Belt Retired Employee
    166 Views

    The compiler should never have allowed this. AutoCoarray can't be automatic, because it has the SAVE attribute. But then it has a specification expression for bounds, which makes it automatic.

    There is no explicit prohibition of an "automatic coarray", but the requirement that a coarray be "an associate name, a dummy argument, or have the ALLOCATABLE or SAVE attribute" effectively eliminates that possibility.

    Please report this bug to Intel at https://supporttickets.intel.com/?lang=en-US

    DataScientist
    Valued Contributor I
    165 Views

    Dear Steve, I reported the bug. Your comments are always very informative, thanks!

    Reply