From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12459 invoked by alias); 1 Apr 2014 17:01:43 -0000 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 Received: (qmail 12413 invoked by uid 48); 1 Apr 2014 17:01:38 -0000 From: "tim.moloney at mrsl dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/60731] New: dynamic library not getting reinitialized on multiple calls to dlopen() Date: Tue, 01 Apr 2014 17:01:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: tim.moloney at mrsl dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-04/txt/msg00072.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60731 Bug ID: 60731 Summary: dynamic library not getting reinitialized on multiple calls to dlopen() Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: tim.moloney at mrsl dot com Created attachment 32518 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32518&action=edit Example showing failure to initialize a dynamic library after multiple calls to dlopen(). If a dynamic library is loaded multiple times via dlopen(), subsequent loads do not correctly initialize static variables under the following conditions: 1) A class/struct with a constructor 2) with an inlined function 3) containing a static variable. Please run the attached example. # tar xf gcc_static_issue.tgz # cd gcc_static_issue # make # ./test_static Expected behavior (as on RHEL5, g++ 4.1.2): Type 'q' to exit or enter to reload/run the DLL count:1 count:1 count:1 count:1 count:1 q # Actual behavior (as on RHEL6 and RHEL7beta, g++ 4.4.7 and 4.8.2, respectively): Type 'q' to exit or enter to reload/run the DLL count:1 count:2 count:3 count:4 count:5 q #