From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28701 invoked by alias); 6 Feb 2015 12:45:29 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 28663 invoked by uid 48); 6 Feb 2015 12:45:26 -0000 From: "tkoenig at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/64958] New: Warn if INTENT(IN) is changed by passing to no-intent argument Date: Fri, 06 Feb 2015 12:45:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: tkoenig at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-02/txt/msg00565.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64958 Bug ID: 64958 Summary: Warn if INTENT(IN) is changed by passing to no-intent argument Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: tkoenig at gcc dot gnu.org Consider the following code: module foo implicit none contains subroutine bar(n) integer, intent(in) :: n print *,"bar before dusty", n call dusty(n) print *,"bar after dusty", n end subroutine bar end module foo program main use foo implicit none integer :: n n = 5 call bar(n) end program main subroutine dusty(n) integer n n = n - 1 end What "dusty" does is illegal, but it may not be easy for the programmer to catch this (especially if "dusty" is in a library). So, it would be nice if -fcheck=all would contain a check which checked if intent(in) dummy arguments are changed by being passed to intent(none).