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

            Bug ID: 57360
           Summary: Implement a warning for implied save
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: Joost.VandeVondele at mat dot ethz.ch

The following is a code snippet with an implicit save for the variable I.

 SUBROUTINE T()
 INTEGER :: I=1
 WRITE(6,*) I
 I=I+1
 END SUBROUTINE T

 CALL T()
 CALL T()
 END

Expecting this code to print twice 1 is one of the common mistakes for (C)
programmers starting with Fortran, see e.g.
http://www.cs.rpi.edu/~szymansk/OOF90/bugs.html

It would be nice if the compiler could optionally (-Wextra?) emit a warning for
implicit save attributes. Obviously the explicit code 'INTEGER, SAVE :: I=1'
should be fine.

Reply via email to