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

Over-enthusiastic type declaration checking in array constructor implied do

IanH
Honored Contributor III
955 Views

Fortran 2018 introduced the capability to specify the type of the index in an implied do in an array constructor (i.e. an ac-implied-do - F2018 R774 for syntax, F2018 19.4p5 for description of the relevant scope rules).  This appears in the documentation for the current oneAPI release (2022.1) - see here.  The compiler seems to know about this feature... but trips over subsequent silliness.

 

PROGRAM ArrayConstructorWithTypeSpec
  IMPLICIT NONE
  INTEGER, ALLOCATABLE :: a(:)
  a = [(i, INTEGER :: i = 1, 10)]
  PRINT *, a
END PROGRAM ArrayConstructorWithTypeSpec

 

>ifort /check:all /warn:all /standard-semantics "2022-01-04 array-constructor.f90"
Intel(R) Fortran Intel(R) 64 Compiler Classic for applications running on Intel(R) 64, Version 2021.5.0 Build 20211109_000000
Copyright (C) 1985-2021 Intel Corporation.  All rights reserved.

2022-01-04 array-constructor.f90(4): error #6404: This name does not have a type, and must have an explicit type.   [I]
  a = [(i, INTEGER :: i = 1, 10)]
----------------------^
compilation aborted for 2022-01-04 array-constructor.f90 (code 1)

In the compilers documentation for array constructors (as linked above) - the expression provided for the assignment to C3 in one of the examples has a syntax error.  The INTEGER :: type spec is in the wrong spot - it can either go before the second opening parenthesis (specifies the type of the entire constructor) or after the first comma (specifies the kind of the ac-do-variable, as per the feature discussed above).

IanH_0-1641272461649.png 

The example later for the extension where mixed real kinds are accepted also presumably has a syntax error (missing closing parenthesis).

(Can those who prepare the downloadable html documentation (such as used for F1 help) please test things like the index on the Firefox browser - there are apparent attempts to use cross-origin objects that prevent the index and the like from functioning locally within that browser.)

4 Replies
Barbara_P_Intel
Employee
918 Views

Happy New Year! This is a 3-fer, three bugs in one comment!

Let me look into these.


0 Kudos
Barbara_P_Intel
Employee
905 Views

An update for you...

  1. I added your reproducer to an outstanding bug for what looks like the same issue. Bug ID is CMPLRIL0-33539. There is an awful workaround... remove the IMPLICIT NONE.
  2. I filed DOC-9465 to correct the example in the Fortran Developer Guide and Reference.
  3. Still waiting for a reply about the .html files.

0 Kudos
Barbara_P_Intel
Employee
883 Views

Now for issue #3... That's a known issue with Firefox. It's recommended that you use Chrome or Explorer. See the Fortran Developer Guide. There's a note on the main page.

 

0 Kudos
Barbara_P_Intel
Employee
740 Views

Issues #1 and #2 are fixed in the recent release of oneAPI version 2022.2. The ifort version is 2021.6.0.



0 Kudos
Reply