public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/35299]  New: scope of variables in statement function do not acquire rank from host
@ 2008-02-22 23:31 kargl at gcc dot gnu dot org
  2008-02-22 23:33 ` [Bug fortran/35299] " kargl at gcc dot gnu dot org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: kargl at gcc dot gnu dot org @ 2008-02-22 23:31 UTC (permalink / raw)
  To: gcc-bugs

In a statement function, only the type and kind are determined from the host.
gfortran fails to compile 

troutmask:kargl[205] cat n.f
      SUBROUTINE PHTOD(E,N,I,H)
      DIMENSION E(N)
      HSTAR(E,B)=B**.4*((1.25*FUN(-E/40)+.18)) ! Doesn't work.
C     HSTAR(X,Y)=Y**.4*((1.25*FUN(-X/40)+.18)) ! Works.
      A = 1.
      H = HSTAR(E(I-1), A)
      END

troutmask:kargl[207] ftnchek n.f

FTNCHEK Version 3.3 November 2004

File n.f:
 0 syntax errors detected in file n.f
No main program found
Warning: Subprogram FUN never defined
    Invoked in module PHTOD line 3 file n.f
    (possibly it is an array which was not declared)
troutmask:kargl[208] gfc -c n.f
n.f:1.24:

      SUBROUTINE PHTOD(E,N,I,H)                                         
                       1
Error: Argument 'e' of statement function at (1) must be scalar

If the reference to FUN in statement function is changed to an
elemental function, then one gets an additional error.  Changing
FUN to SIN yields

troutmask:kargl[210] gfc -c n.f
n.f:1.24:

      SUBROUTINE PHTOD(E,N,I,H)                                         
                       1
Error: Argument 'e' of statement function at (1) must be scalar
n.f:3.11:

      HSTAR(E,B)=B**.4*((1.25*SIN(-E/40)+.18)) ! Doesn't work.          
          1
Error: Incompatible ranks 0 and 1 in assignment at (1)

Because statement functions are obselscent in Fortran 95, this should be
considered a very low priority bug.


-- 
           Summary: scope of variables in statement function do not acquire
                    rank from host
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kargl at gcc dot gnu dot org


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


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

end of thread, other threads:[~2008-08-08 23:48 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-22 23:31 [Bug fortran/35299] New: scope of variables in statement function do not acquire rank from host kargl at gcc dot gnu dot org
2008-02-22 23:33 ` [Bug fortran/35299] " kargl at gcc dot gnu dot org
2008-02-23 20:23 ` tkoenig at gcc dot gnu dot org
2008-02-29 17:54 ` fxcoudert at gcc dot gnu dot org
2008-02-29 20:15 ` sgk at troutmask dot apl dot washington dot edu
2008-02-29 20:24 ` fxcoudert at gcc dot gnu dot org
2008-02-29 20:42 ` sgk at troutmask dot apl dot washington dot edu
2008-02-29 22:56 ` fxcoudert at gcc dot gnu dot org
2008-02-29 23:06 ` sgk at troutmask dot apl dot washington dot edu
2008-02-29 23:53 ` sgk at troutmask dot apl dot washington dot edu
2008-08-08 21:07 ` jv244 at cam dot ac dot uk
2008-08-08 23:48 ` sgk at troutmask dot apl dot washington 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).