From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7120 invoked by alias); 5 Dec 2011 20:04:39 -0000 Received: (qmail 7109 invoked by uid 22791); 5 Dec 2011 20:04:38 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,TW_DD,TW_OV 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, 05 Dec 2011 20:04:25 +0000 From: "toon at moene dot org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/51310] -finit-bla doesn't initialize *all* items of type bla to the requested constant. Date: Mon, 05 Dec 2011 20:04: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: toon at moene dot org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: toon at moene dot 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" Content-Transfer-Encoding: quoted-printable 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: 2011-12/txt/msg00470.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D51310 --- Comment #3 from Toon Moene 2011-12-05 20:04:21 = UTC --- At first I thought that gfortran would initialize small local arrays to whatever -finit-real indicated by making them static, instead of stack base= d. However, perusing the assembler output of subroutine sub real a(3) print*,a end (as a diff between gfortran -S and gfortran -S -finit-real=3Dsnan): 17c17,27 < movq $.LC0, -536(%rbp) --- > movl $1, %eax > .L3: > cmpq $3, %rax > jg .L2 > leaq -1(%rax), %rdx > movl $0x7fa00000, %ecx > movl %ecx, -16(%rbp,%rdx,4) > addq $1, %rax > jmp .L3 > .L2: and checking with a small main program call sub end that the output is really different: $ ./a.out 1.12103877E-44 0.0000000 9.80908925E-45 vs: $ ./a.out NaN NaN NaN convinced me otherwise. So one wonders why that doesn't work with variable length automatic arrays = (or why it would even be hard to initialize malloc'd automatic arrays / allocatables). This quest to be continued ("do you think coconuts migrate ? No - but they could be carried.").