public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "bdavis at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/42267]  New: interaction between -finit-local-zero and -fno-automatic
Date: Thu, 03 Dec 2009 19:14:00 -0000	[thread overview]
Message-ID: <bug-42267-8277@http.gcc.gnu.org/bugzilla/> (raw)

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


             reply	other threads:[~2009-12-03 19:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-03 19:14 bdavis at gcc dot gnu dot org [this message]
2009-12-03 19:16 ` [Bug fortran/42267] " bdavis at gcc dot gnu dot org
2009-12-03 20:06 ` burnus at gcc dot gnu dot org
2009-12-03 20:21 ` bdavis at gcc dot gnu dot org
2009-12-03 20:47 ` burnus at gcc dot gnu dot org
2009-12-03 21:14 ` rguenth at gcc dot gnu dot org
2009-12-03 21:19 ` burnus at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-42267-8277@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).