From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7187 invoked by alias); 9 Jan 2012 10:03:12 -0000 Received: (qmail 7129 invoked by uid 22791); 9 Jan 2012 10:03:11 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 09 Jan 2012 10:02:58 +0000 From: "burnus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/51638] gfortran optimization breaks a single variable used as both input and output for subroutine call Date: Mon, 09 Jan 2012 10:03:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: burnus at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 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 X-SW-Source: 2012-01/txt/msg00835.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51638 --- Comment #13 from Tobias Burnus 2012-01-09 10:01:59 UTC --- (In reply to comment #12) > I am surprised to see that none of the compilers I tested (gfortran, ifort, > g95) complain about the fact that the same variable is used as both > intent(in) and intent(out) variable. Shouldn't it be at least a warning? gfortran with -Waliasing (or -Wall) actually warns - but not by default: call iei4ei(in4,in4) 1 Warning: Same actual argument associated with INTENT(IN) argument 'inpu' and INTENT(OUT) argument 'oupu' at (1) The argument agains warning by default is that one can write perfectly valid code such as: call iei4ei(in4, in4, false) contains subroutine iei4ei (out, in, mod) integer :: out, in logical :: mod if (mod) out = 5 end subroutine ie4ei Nevertheless, one could think of warning by default.