Bug 13939 - Does not accept missing subroutine arguments like g77
Summary: Does not accept missing subroutine arguments like g77
Status: RESOLVED WONTFIX
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: tree-ssa
: P2 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks: 19292
  Show dependency treegraph
 
Reported: 2004-01-31 01:45 UTC by bdavis9659
Modified: 2007-07-28 20:18 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2005-12-30 18:43:32


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description bdavis9659 2004-01-31 01:45:52 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
       CALL VARARGS(I,,)
       END
       SUBROUTINE VARARGS(I,J,K)
       PRINT*,I
       END
$ g77 example7.f
example7.f: In subroutine `varargs':
example7.f:2: warning:
          CALL VARARGS(I,,)
               1
example7.f:4: (continued):
          SUBROUTINE VARARGS(I,J,K)
                     2
Too many arguments for `varargs' at (1) versus invocation at (2) [info -f g77 M
GLOBALS]
$ ./a.out
 1
$ /usr/local/bin/gfortran example7.f
 In file example7.f:2
 
       CALL VARARGS(I,,)
                     1
Error: Syntax error in argument list at (1)

$ /usr/local/bin/gfortran --version
GNU Fortran 95 (GCC 3.5-tree-ssa 20040128 (merged 20040102))
Comment 1 Andrew Pinski 2004-02-06 01:20:08 UTC
Confirmed.
Comment 2 Tobias Schlüter 2004-06-02 12:37:33 UTC
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
argument".
                                                                                
   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.
Comment 3 Paul Thomas 2006-11-07 21:45:43 UTC
I have removed the rejects valid - enhancement will do.

Paul
Comment 4 Francois-Xavier Coudert 2007-07-28 20:18:59 UTC
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!