Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs have moved to the Altera Community. Existing Intel Community members can sign in with their current credentials.
29306 Discussions

declaration within implied do loop

Vivek_R_
Novice
694 Views

I think the code

 

program implied_do_declaration
implicit none
integer, allocatable :: vec(:)
vec = [(2*i, integer :: i=1,3)]
print*,vec ! 2 4 6
end program implied_do_declaration

 

is valid Fortran 2018 but Intel Fortran says

 

ifort -standard-semantics -stand:f18 implied_do.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.

implied_do.f90(4): error #6404: This name does not have a type, and must have an explicit type. [I]
vec = [(2*i, integer :: i=1,3)]
------------------------^
compilation aborted for implied_do.f90 (code 1)

0 Kudos
1 Reply
Reply