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

Feature request: warn about string concatenation not contributing

w_l_kleb
Beginner
315 Views
Hi,

I'd like to see the Fortran Intel compiler at least give a warning if a string concatenation does not contribute to the result, viz,

% cat > non_contributing.f90 << EOF
program non_contributing
character(10) :: command
character(100) :: middle = 'begin'
command = middle//'end'
print*,command
end program
EOF

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

% ifort -c -warn -check non_contributing.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 -c non_contributing.f90
f90: Warning: non_contributing.f90, line 4: Expression does not contribute to result
command = middle//'end'
------------------^

Thanks for consideration,
--
Bil, 757.812.1805
0 Kudos
3 Replies
w_l_kleb
Beginner
315 Views
And so does gfortran:

% gfortran --version | head -1
GNU Fortran (GCC) 4.6.2 20111019 (prerelease)

% gfortran -c -Wall non_contributing.f90 non_contributing.f90:4.25:

command = middle//'end'
1
Warning: CHARACTER expression will be truncated in assignment (10/103) at (1)

0 Kudos
Steven_L_Intel1
Employee
315 Views
Thanks for the suggestion. I know that DEC/Compaq Fortran did give such a warning. I have entered a feature request for you, the ID is DPD200234070.
0 Kudos
w_l_kleb
Beginner
315 Views
Excellent; thanks.
0 Kudos
Reply