public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "francois dot jacq at irsn dot fr" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/40167] New: wrong initialization of local variable in a recursive subroutine Date: Sat, 16 May 2009 08:46:00 -0000 [thread overview] Message-ID: <bug-40167-15407@http.gcc.gnu.org/bugzilla/> (raw) In the following program, env%n should be equal to zero when entering the routine "titi" but one gets the output : 10 0 5 10 instead of 10 0 5 0 as if the local variable "env" was declared "save" within "titi". Notice that the bug disappears if the allocatable array "a" is deleted in the definition of "env_type" : so the presence of an allocatable element within a derived type seems to be related to that bug. MODULE m TYPE env_type INTEGER :: n=0 INTEGER,ALLOCATABLE :: a(:) END TYPE CONTAINS RECURSIVE SUBROUTINE titi(n) INTERFACE RECURSIVE SUBROUTINE tata() END SUBROUTINE END INTERFACE TYPE(env_type) :: env WRITE(*,*) n,env%n env%n=n IF(n == 5) STOP CALL tata() END SUBROUTINE END MODULE RECURSIVE SUBROUTINE tata USE m CALL titi(5) END SUBROUTINE PROGRAM test USE m INTERFACE RECURSIVE SUBROUTINE tata() END SUBROUTINE END INTERFACE CALL titi(10) END PROGRAM -- Summary: wrong initialization of local variable in a recursive subroutine Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: francois dot jacq at irsn dot fr GCC host triplet: windows xp i386 GCC target triplet: gcc 4.3.0 20080305 (alpha-testing) mingw-20080502 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40167
next reply other threads:[~2009-05-16 8:46 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2009-05-16 8:46 francois dot jacq at irsn dot fr [this message] 2009-05-18 4:46 ` [Bug fortran/40167] " pault at gcc dot gnu dot org 2009-05-18 6:41 ` burnus at gcc dot gnu dot org 2009-05-18 7:44 ` francois dot jacq at irsn dot fr 2009-05-18 8:17 ` francois dot jacq at irsn dot fr 2009-05-18 8:51 ` 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-40167-15407@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: linkBe 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).