Bug 27587 - Warn when Scalar constant passed to array dummy argument
Summary: Warn when Scalar constant passed to array dummy argument
Status: RESOLVED DUPLICATE of bug 26227
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.2.0
: P3 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-05-13 13:56 UTC by tobias.burnus
Modified: 2006-05-13 23:18 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description tobias.burnus 2006-05-13 13:56:03 UTC
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]
Comment 1 Andrew Pinski 2006-05-13 23:18:48 UTC
This is another dup of bug 26227.

*** This bug has been marked as a duplicate of 26227 ***