GCC Bugzilla – Bug 13939
Does not accept missing subroutine arguments like g77
Last modified: 2007-07-28 20:18:59 UTC
Below code is accepted by g77 (albeit with warnings) and is rejected by gfortran.
This is not "standard conforming" f77,f66, or f90 code, but it was supported by
at least one f77 compiler (SEL/Gould) and is currently accepted by g77.
$ cat example7.f
I = 1
$ g77 example7.f
example7.f: In subroutine `varargs':
Too many arguments for `varargs' at (1) versus invocation at (2) [info -f g77 M
$ /usr/local/bin/gfortran example7.f
In file example7.f:2
Error: Syntax error in argument list at (1)
$ /usr/local/bin/gfortran --version
GNU Fortran 95 (GCC 3.5-tree-ssa 20040128 (merged 20040102))
As to the precise meaning of this feature, I quote the g77 documentation:
The `-fugly-comma' option enables use of a single trailing comma to
mean "pass an extra trailing null argument" in a list of actual
arguments to an external procedure, and use of an empty list of
arguments to such a procedure to mean "pass a single null argument".
(Null arguments often are used in some procedure-calling schemes to
indicate omitted arguments.)
For example, `CALL FOO(,)' means "pass two null arguments", rather
than "pass one null argument". Also, `CALL BAR()' means "pass one null
This construct is considered "ugly" because it does not provide an
elegant way to pass a single null argument that is syntactically
distinct from passing no arguments. That is, this construct changes
the meaning of code that makes no use of the construct.
This doesn't seem to conincide with the output Bud quoted, so apparently g77
accepts those commas even with -fno-ugly-commas, passing nothing for those
omitted arguments it seems.
I have removed the rejects valid - enhancement will do.
After some talk among gfortran developers on IRC, it seems that there is consensus that we won't be implementing this particular g77 feature. I'm thus closing this bug as WONTFIX.
Of course, if anyone is interested in adding support for it in gfortran, please feel free to reopen it and make plans to add the feature!