From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21592 invoked by alias); 3 Dec 2009 19:14:18 -0000 Received: (qmail 21159 invoked by uid 48); 3 Dec 2009 19:13:58 -0000 Date: Thu, 03 Dec 2009 19:14:00 -0000 Subject: [Bug fortran/42267] New: interaction between -finit-local-zero and -fno-automatic X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "bdavis at gcc dot gnu dot org" 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: 2009-12/txt/msg00307.txt.bz2 when using both flags, the variables are initialized on every function call. see the example below: bash-3.2$ cat lvar.f REAL A(100) PRINT*,'Expect them to be zero' CALL ONE PRINT*,'Expect them to be 1..10' CALL TWO PRINT*,'Expect them to be 1..10' CALL ONE END SUBROUTINE ONE REAL A(100) INTEGER I PRINT*,"Sub One Loc(a) is ",LOC(A) DO I=1,10 PRINT*,A(I) A(I) = I END DO END SUBROUTINE TWO REAL A(100) INTEGER I PRINT*,"Sub Two Loc(a) is ",LOC(A) DO I = 1,10 A(I) = 0 END DO END bash-3.2$ /usr/local/bin/gfortran -static lvar.f -finit-local-zero -fno-automatic bash-3.2$ /usr/local/bin/gfortran --version GNU Fortran (GCC) 4.4.1 Copyright (C) 2009 Free Software Foundation, Inc. GNU Fortran comes with NO WARRANTY, to the extent permitted by law. You may redistribute copies of GNU Fortran under the terms of the GNU General Public License. For more information about these matters, see the file named COPYING bash-3.2$ ./a.out Expect them to be zero Sub One Loc(a) is 135144832 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 Expect them to be 1..10 Sub Two Loc(a) is 135144416 Expect them to be 1..10 Sub One Loc(a) is 135144832 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 -- Summary: interaction between -finit-local-zero and -fno-automatic Product: gcc Version: 4.4.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: bdavis at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42267