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 on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29283 Discussions

Feature request: warn about argument declarations out of order

w_l_kleb
Beginner
2,026 Views
Hi,

I'd like to see the Intel compiler at least give a warning
if arguments are given out of order, viz,

% cat > argument_order.f90 << EOF
subroutine test_arg_order( nvals, array )
implicit none
integer, dimension(nvals), intent(in) :: array ! use nvals before declared
integer, intent(in) :: nvals
print*, array, nvals
end subroutine
EOF

% ifort --version | head -1
ifort (IFORT) 12.1.3 20120212

% ifort -c -warn -check argument_order.f90
[no complaints]

It's antecedent does:

alpha% fort -what
Compaq Fortran V1.2.0-1882
Compaq Fortran Compiler V1.2.0-1882-48BBF
alpha% fort argument_order.f90
f90: Error: argument_order.f90, line 3: This name does not have a type, and must have an explicit type. [NVALS]
integer, dimension(nvals), intent(in) :: array ! use nvals before declared
---------------------^
f90: Error: argument_order.f90, line 3: A specification expression is invalid. [NVALS]
integer, dimension(nvals), intent(in) :: array ! use nvals before declared
---------------------^

Thanks for consideration,
--
Bil, 757.812.1805



0 Kudos
3 Replies
w_l_kleb
Beginner
2,026 Views
And so does gfortran, viz,
% gfortran --version | head -1
GNU Fortran (GCC) 4.6.2 20111019

% gfortran -c -pedantic-errors argument_order.f90
argument_order.f90:3.21:

integer, dimension(nvals), intent(in) :: array
1
Warning: Extension: Symbol 'nvals' is used before it is typed at (1)

0 Kudos
Steven_L_Intel1
Employee
2,026 Views
We decided to allow this as an extension, but in a release later this year we'll give a standards warning for it:

t.f90(3): warning #8586: Implicit type is given to allow out-of-order declaration. Non-standard extension. [NVALS]
integer, dimension(nvals), intent(in) :: array ! use nvals before declared
---------------------^
0 Kudos
w_l_kleb
Beginner
2,026 Views
Excellent news (about the standards warning in a release later this year)!

Thanks,
--
Bil
0 Kudos
Reply