public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/28004]  New: Warn if intent(out) dummy variable is not set
@ 2006-06-12 20:18 tobias dot burnus at physik dot fu-berlin dot de
  2006-06-13 19:48 ` [Bug fortran/28004] " pault at gcc dot gnu dot org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: tobias dot burnus at physik dot fu-berlin dot de @ 2006-06-12 20:18 UTC (permalink / raw)
  To: gcc-bugs

GNU Fortran 95 (GCC) 4.2.0 20060612.

If I write a program with a intent(out) variable and this varibale is not set,
gfortran only writes:
  warning: unused variable C

Expected: Default warning like ifort/NAG f95/g95:
 In file ff.f90:7
 subroutine sub(a)
                 1
 Warning (158): INTENT(OUT) variable 'a' at (1) is never set
---
 Warning: ff.f90, line 11: INTENT(OUT) dummy argument A never set
---
fortcom: Warning: ff.f90, line 7: A dummy argument with an explicit INTENT(OUT)
declaration is not given an explicit value.   [A]
subroutine sub(a)
---------------^

Test program:
-----------------
program test
  implicit none
  real :: a
  call sub(a)
end program test

subroutine sub(a)
  implicit none
  real, intent(out) :: a
  print *,a
end subroutine sub
-----------------

If you want, you can also -Wall warn that 'a' is used before it has gotten any
value assiged. (And Fortran does not guarantee for intent(out) that the
variable is set, even if I had add an a = 4.0 before the call sub(a).)
Actually, none of the other compilers detects this at compile time, at run time
NAG f95 (-nan or -C=undefined) does.


-- 
           Summary: Warn if intent(out) dummy variable is not set
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tobias dot burnus at physik dot fu-berlin dot de


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


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

end of thread, other threads:[~2007-07-09 12:57 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-12 20:18 [Bug fortran/28004] New: Warn if intent(out) dummy variable is not set tobias dot burnus at physik dot fu-berlin dot de
2006-06-13 19:48 ` [Bug fortran/28004] " pault at gcc dot gnu dot org
2006-06-14  9:25 ` tobias dot burnus at physik dot fu-berlin dot de
2006-11-02  9:47 ` fxcoudert at gcc dot gnu dot org
2006-11-03 19:59 ` burnus at gcc dot gnu dot org
2006-11-11 11:18 ` tkoenig at gcc dot gnu dot org
2007-07-03 21:00 ` dfranke at gcc dot gnu dot org
2007-07-03 21:06 ` dfranke at gcc dot gnu dot org
2007-07-08 22:41 ` dfranke at gcc dot gnu dot org
2007-07-08 22:55 ` [Bug fortran/28004] Warn if intent(out) dummy variable is used before being defined dfranke at gcc dot gnu dot org
2007-07-09 12:57 ` dfranke at gcc dot gnu dot 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).