public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/25174]  New: gfortran ignores explicit return type for functions
@ 2005-11-30  1:43 albertm at uphs dot upenn dot edu
  2005-12-06 22:14 ` [Bug fortran/25174] " tkoenig at gcc dot gnu dot org
  2005-12-06 22:53 ` albertm at uphs dot upenn dot edu
  0 siblings, 2 replies; 3+ messages in thread
From: albertm at uphs dot upenn dot edu @ 2005-11-30  1:43 UTC (permalink / raw)
  To: gcc-bugs

gfortran seems to ignore explicit return types of functions.

Example follows:
-----------------------------bug.for--------------------------------
      PROGRAM BUG
      external real function Mfunc
      real*4 X,Y

      X = Xfunc()
      Y = Mfunc()
      write(6,*) X,Y
      stop
      end

      real function Xfunc()
      Xfunc = 17.232
      return 
      end

      real function Mfunc()
      Mfunc = 17.232
      return 
      end
-----------------------------bug.for------------------------------
When run, this gives:
   17.23200      1.0995535E+09
STOP 0

Compilation was:
[...]/gfortran -Wall -o bug bug.for -L[...]/lib64 \
            -Wl,-rpath,[...]/lib64
(Long path names replaced with [...]).

As usual, thank you very much.  The gcc collection is a wonderful
tool.

-Mike


-- 
           Summary: gfortran ignores explicit return type for functions
           Product: gcc
           Version: 4.0.2
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: albertm at uphs dot upenn dot edu
  GCC host triplet: x86_64-unknown-linux-gnu


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


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

* [Bug fortran/25174] gfortran ignores explicit return type for functions
  2005-11-30  1:43 [Bug fortran/25174] New: gfortran ignores explicit return type for functions albertm at uphs dot upenn dot edu
@ 2005-12-06 22:14 ` tkoenig at gcc dot gnu dot org
  2005-12-06 22:53 ` albertm at uphs dot upenn dot edu
  1 sibling, 0 replies; 3+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2005-12-06 22:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from tkoenig at gcc dot gnu dot org  2005-12-06 22:14 -------
(In reply to comment #0)

>       PROGRAM BUG
>       external real function Mfunc

This declares an external symbol called
"realfunctionmfunc" (fixed form), which is
probably not what you intended.

If you replace that line by

      real Mfunc
      external Mfunc

things work.  If you try to compile this in free form
(extension .f95), you get a syntax error.

I'm resolving this as "invalid".  Feel free to re-open it
if you believe that I haven't addressed the issue correctly.

        Thomas


-- 

tkoenig at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tkoenig at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


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

* [Bug fortran/25174] gfortran ignores explicit return type for functions
  2005-11-30  1:43 [Bug fortran/25174] New: gfortran ignores explicit return type for functions albertm at uphs dot upenn dot edu
  2005-12-06 22:14 ` [Bug fortran/25174] " tkoenig at gcc dot gnu dot org
@ 2005-12-06 22:53 ` albertm at uphs dot upenn dot edu
  1 sibling, 0 replies; 3+ messages in thread
From: albertm at uphs dot upenn dot edu @ 2005-12-06 22:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from albertm at uphs dot upenn dot edu  2005-12-06 22:52 -------
Subject: Re:  gfortran ignores explicit return type for
 fun ctions

Thank you very much.  My apologies.  I don't understand Fortran as
well as I should.

Sincerely,
 Mike Albert


On Tue, 6 Dec 2005, tkoenig at gcc dot gnu dot org wrote:

> 
> 
> ------- Comment #1 from tkoenig at gcc dot gnu dot org  2005-12-06 22:14
> -------
> (In reply to comment #0)
> 
> >       PROGRAM BUG
> >       external real function Mfunc
> 
> This declares an external symbol called
> "realfunctionmfunc" (fixed form), which is
> probably not what you intended.
> 
> If you replace that line by
> 
>       real Mfunc
>       external Mfunc
> 
> things work.  If you try to compile this in free form
> (extension .f95), you get a syntax error.
> 
> I'm resolving this as "invalid".  Feel free to re-open it
> if you believe that I haven't addressed the issue correctly.
> 
>         Thomas
> 
> 
> -- 
> 
> tkoenig at gcc dot gnu dot org changed:
> 
>            What    |Removed                     |Added
> ------------------------------------------------------------------------
> ----
>                  CC|                            |tkoenig at gcc dot gnu
> dot
>                    |                            |org
>              Status|UNCONFIRMED                 |RESOLVED
>          Resolution|                            |INVALID
> 
> 
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25174
> 
> ------- You are receiving this mail because: -------
> You reported the bug, or are watching the reporter.
> 


-- 


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


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

end of thread, other threads:[~2005-12-06 22:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-30  1:43 [Bug fortran/25174] New: gfortran ignores explicit return type for functions albertm at uphs dot upenn dot edu
2005-12-06 22:14 ` [Bug fortran/25174] " tkoenig at gcc dot gnu dot org
2005-12-06 22:53 ` albertm at uphs dot upenn dot edu

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).