From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18369 invoked by alias); 17 Dec 2011 09:39:35 -0000 Received: (qmail 18357 invoked by uid 22791); 17 Dec 2011 09:39:34 -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; Sat, 17 Dec 2011 09:39:21 +0000 From: "burnus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/51591] Strange output from STOP statement in OpenMP region Date: Sat, 17 Dec 2011 10:21: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: openmp X-Bugzilla-Severity: minor X-Bugzilla-Who: burnus at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: CC 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: 2011-12/txt/msg01912.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51591 Tobias Burnus changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jb at gcc dot gnu.org --- Comment #1 from Tobias Burnus 2011-12-17 09:39:05 UTC --- (In reply to comment #0) > > cat testc.c > int sleepc_ (unsigned int *sec) This function is actually not used but gfortran's intrinsic "sleep". (The Fortran program calls "sleep" instead of "sleepc".) > Sometimes output looks OK: > But more often there is some garbled text output: > 0im `m5 <<<<----- What's this? I can reproduce this - though for me the output is more often OK than garbled (60% vs. 40% of the output of: for((I=0;$I < 20; I++)); do ./a.out ; done ) That's with GCC 4.6. In GCC 4.7, it works much more often (I have to run the the line above about ~20 times, i.e. approx every 400th run it fails). Additionally, in 4.7 I do not see garbled output but a segfault. A backtrace of the core dump shows: Program terminated with signal 11, Segmentation fault. #0 _gfortrani_fbuf_flush (u=0x6055d0, mode=) at /home/tob/projects/gcc-git/gcc/libgfortran/io/fbuf.c:166 166 if (u->fbuf->act > u->fbuf->pos && u->fbuf->pos > 0) (gdb) bt #1 0x00002b37379836bd in _gfortrani_next_record (dtp=0x2b373926dc50, done=1) at /home/tob/projects/gcc-git/gcc/libgfortran/io/transfer.c:3397 #2 0x00002b3737983f79 in _gfortran_st_write_done (dtp=0x2b373926dc50) at /home/tob/projects/gcc-git/gcc/libgfortran/io/transfer.c:3592 (gdb) p u->fbuf $3 = (struct fbuf *) 0x7e7e7e7e7e7e7e7e The value matches: $ echo $MALLOC_PERTURB_ 126 Thus, "fbuf" points to malloced memory, which has never been initialized. > feature.> I think gfortran (like several other compilers) does so since years; new (since 4.6) is the support for constant character and integer expressions for (error) stop.