public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/58307] New: Bogus error 'Function requires an argument list'
@ 2013-09-03 12:30 janus at gcc dot gnu.org
  2013-09-03 13:05 ` [Bug fortran/58307] " janus at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: janus at gcc dot gnu.org @ 2013-09-03 12:30 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58307

            Bug ID: 58307
           Summary: Bogus error 'Function requires an argument list'
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: janus at gcc dot gnu.org

Reported by Jan Wittke at
https://groups.google.com/forum/?fromgroups=#!topic/comp.lang.fortran/93BFKizfmEM
...


The following (invalid) code:


  implicit none

  type point
    real:: x,y,z
  end type

  real(point) :: this

end



produces (with 4.7, 4.8 and trunk) the error message

  real(point) :: this
            1
Error: Function 'point' requires an argument list at (1)

which is misleading, since 'point' is obviously not a function.



4.3 gives:

  real(point) :: this
            1
Error: Syntax error in structure constructor at (1)

which is not much better, since no structure constructor is involved here,
either.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug fortran/58307] Bogus error 'Function requires an argument list'
  2013-09-03 12:30 [Bug fortran/58307] New: Bogus error 'Function requires an argument list' janus at gcc dot gnu.org
@ 2013-09-03 13:05 ` janus at gcc dot gnu.org
  2013-09-03 13:37 ` dominiq at lps dot ens.fr
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: janus at gcc dot gnu.org @ 2013-09-03 13:05 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58307

--- Comment #1 from janus at gcc dot gnu.org ---
(In reply to janus from comment #0)
> produces (with 4.7, 4.8 and trunk) the error message
> 
>   real(point) :: this
>             1
> Error: Function 'point' requires an argument list at (1)


This error message comes from gfc_match_rvalue in primary.c.

For some reason, the 'point' symbol has attr.function and attr.generic set and
attr.flavor == FL_PROCEDURE.

Maybe the problem was introduced with the implementation of 'constructors' in
4.7?


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug fortran/58307] Bogus error 'Function requires an argument list'
  2013-09-03 12:30 [Bug fortran/58307] New: Bogus error 'Function requires an argument list' janus at gcc dot gnu.org
  2013-09-03 13:05 ` [Bug fortran/58307] " janus at gcc dot gnu.org
@ 2013-09-03 13:37 ` dominiq at lps dot ens.fr
  2013-09-03 13:50 ` janus at gcc dot gnu.org
  2013-09-03 19:34 ` burnus at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: dominiq at lps dot ens.fr @ 2013-09-03 13:37 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58307

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-09-03
     Ever confirmed|0                           |1

--- Comment #2 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
4.6.4 gives

Error: Syntax error in structure constructor at (1)

and 4.7.3

Error: Function 'point' requires an argument list at (1)

Would you expect an error of the kind

Error: Parameter 'point' at (1) has not been declared or is a variable, which
does not reduce to a constant expression

?


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug fortran/58307] Bogus error 'Function requires an argument list'
  2013-09-03 12:30 [Bug fortran/58307] New: Bogus error 'Function requires an argument list' janus at gcc dot gnu.org
  2013-09-03 13:05 ` [Bug fortran/58307] " janus at gcc dot gnu.org
  2013-09-03 13:37 ` dominiq at lps dot ens.fr
@ 2013-09-03 13:50 ` janus at gcc dot gnu.org
  2013-09-03 19:34 ` burnus at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: janus at gcc dot gnu.org @ 2013-09-03 13:50 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58307

--- Comment #3 from janus at gcc dot gnu.org ---
(In reply to Dominique d'Humieres from comment #2)
> 4.6.4 gives
> 
> Error: Syntax error in structure constructor at (1)
> 
> and 4.7.3
> 
> Error: Function 'point' requires an argument list at (1)

Ok, so the new error message is sort of a regression in 4.7. But since the old
one was not fully correct either, I wouldn't count it as a real regression.



> Would you expect an error of the kind
> 
> Error: Parameter 'point' at (1) has not been declared or is a variable,
> which does not reduce to a constant expression
> 
> ?

Well, sounds a bit better at least (although 'point' is not a parameter).


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug fortran/58307] Bogus error 'Function requires an argument list'
  2013-09-03 12:30 [Bug fortran/58307] New: Bogus error 'Function requires an argument list' janus at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2013-09-03 13:50 ` janus at gcc dot gnu.org
@ 2013-09-03 19:34 ` burnus at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-09-03 19:34 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58307

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu.org

--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> ---
(In reply to janus from comment #0)
> produces (with 4.7, 4.8 and trunk) the error message
> 
>   real(point) :: this
>             1
> Error: Function 'point' requires an argument list at (1)
> 
> which is misleading, since 'point' is obviously not a function.


Well, in this case it isn't. However, it is permitted to have a function with
the same generic name as a derived type ("constructors"). That wouldn't help in
this case as one needs a constant/initialization expression, but it explains
the error message.

(Internally, gfortran generates a generic function symbol under the
derived-type name - and links the hidden symbol with the derived type to it.)

As always, providing a good error message in all cases is difficult - the other
error message is also not that friendly as earlier gfortrans show.

pathf95/crayftn have:
  This use of derived type "POINT" is not valid.
g95 has:
  Error: Syntax error in structure constructor at (1)
pgf95 has:
  PGF90-S-0087-Non-constant expression where constant expression required 
  PGF90-S-0081-Illegal selector - KIND parameter has unknown value for data
type
ifort has:
  A kind type parameter must be a compile-time constant.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-09-03 19:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-03 12:30 [Bug fortran/58307] New: Bogus error 'Function requires an argument list' janus at gcc dot gnu.org
2013-09-03 13:05 ` [Bug fortran/58307] " janus at gcc dot gnu.org
2013-09-03 13:37 ` dominiq at lps dot ens.fr
2013-09-03 13:50 ` janus at gcc dot gnu.org
2013-09-03 19:34 ` burnus at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).