From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17937 invoked by alias); 10 Nov 2011 08:14:19 -0000 Received: (qmail 17919 invoked by uid 22791); 10 Nov 2011 08:14:15 -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; Thu, 10 Nov 2011 08:14:02 +0000 From: "burnus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/51073] _gfortran_caf_register incorrectly assumes malloc(0) returns non-NULL Date: Thu, 10 Nov 2011 08:30: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: 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: 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-11/txt/msg01048.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51073 --- Comment #1 from Tobias Burnus 2011-11-10 08:13:54 UTC --- (In reply to comment #0) > I am debugging why some of the gfortran tests are failing. I have tracked NN > failures down to this code in caf/mpi.c around line 155. I think you are looking at the wrong file and the cause is due to libgfortran/caf/single.c, which contains similar code. With coarrays, gfortran can either use single.c ("libcaf_single.a") or mpi.c. While "libcaf_single.a" is build on all systems and tested in gcc/testsuite/gfortran.dg/coarrary/, mpi.c is not build at all. The reason is that building mpi.c strongly depends on the used Message Passing Interface implementation. Thus, it is currently left to the user to fetch mpi.c and libcaf.h and run "mpicc -O2 -c mpi.c". Hence, it is also not automatically tested. I am considering to allow building mpi.c by passing some flags to configure. I am also thinking of supporting it in the testsuite (with some environment variables for the mpi-library path and the running command). However, I have not yet done so. > /* Token contains only a list of pointers. */ > local = malloc (size); > Upon successful completion with size not equal to 0, malloc() shall return a > pointer to the allocated space. If size is 0, either a null pointer or a > unique pointer that can be successfully passed to free() shall be returned. Good point - I have think about how to fix that correctly.