[Bug fortran/27587] New: Warn when Scalar constant passed to array dummy argument
tobias dot burnus at physik dot fu-berlin dot de
gcc-bugzilla@gcc.gnu.org
Sat May 13 13:56:00 GMT 2006
Taken from http://www.polyhedron.com/pb05/linux/diagnose.html
----<ARG7.FOR>-------
real function same(x)
implicit none
real x(1)
same = x(1)
end
program xtwice
implicit none
real same
external same
print*,same(10.0)
print*,'Bug not caught!'
end
----------------------
Current behaviour: prints 10.00000
Expected: Warn/error that argument is not an array.
~> gfortran-4.2 -Wall -pedantic -fbounds-check ARG7.F
ARG7.F:34: warning: no newline at end of file
~> ./a.out
10.00000
Bug not caught!
Comparison with other compilers:
ifort64-9.1 -C -check all -warn all,nodec,interfaces -gen_interfaces -traceback
-fpe0 -fpstkchk ARG7.F
fortcom: Error: ARG7.F, line 31: If the actual argument is scalar, the
corresponding dummy argument shall be scalar unless the actual argu
ment is an element of an array that is not an assumed-shape or pointer array,
or a substring of such an element. [X]
print*,same(10.0)
-------------^
compilation aborted for ARG7.F (code 1)
NAG: f95 -C=all -C=undefined -info -g -gline ARG7.F
Error: /tmp/ARG7.022067.f: Argument X (no. 1) in reference to SAME from XTWICE
is not an array
[f95 error termination]
--
Summary: Warn when Scalar constant passed to array dummy argument
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: tobias dot burnus at physik dot fu-berlin dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27587
More information about the Gcc-bugs
mailing list