From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9318 invoked by alias); 4 Jul 2005 21:18:22 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 9310 invoked by uid 48); 4 Jul 2005 21:18:19 -0000 Date: Mon, 04 Jul 2005 21:18:00 -0000 From: "fxcoudert at gcc dot gnu dot org" To: gcc-bugs@gcc.gnu.org Message-ID: <20050704211818.22298.fxcoudert@gcc.gnu.org> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug libfortran/22298] New: libgfortran init() constructor isn't called if executable is statically linked X-Bugzilla-Reason: CC X-SW-Source: 2005-07/txt/msg00357.txt.bz2 List-Id: $ cat a_fortran.f90 subroutine f print *, '##' end $ gfortran -c a_fortran.f90 $ cat a.c extern void f_(void); int main (void) { f_ (); } $ ./irun/bin/gcc -c a.c $ gfortran -static a.o a_fortran.o && ./a.out Fortran runtime error: End of record $ gfortran a.o a_fortran.o && ./a.out ## This happens because the init() constructor (libgfortran/runtime/main.c) is not called when a.out is executed, if it was linked statically. According to Andrew, one way to make sure that init() is called is to reference it in an object file we're sure will be used. I'm thinking of runtime/error.c. -- Summary: libgfortran init() constructor isn't called if executable is statically linked Product: gcc Version: 4.1.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: libfortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: fxcoudert at gcc dot gnu dot org CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22298