From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10780 invoked by alias); 20 Aug 2014 10:02:16 -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 10758 invoked by uid 48); 20 Aug 2014 10:02:13 -0000 From: "vhaisman at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/62200] New: libstdc++ initialization priority Date: Wed, 20 Aug 2014 10:02:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 4.8.2 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: vhaisman at gmail 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 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-08/txt/msg01347.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62200 Bug ID: 62200 Summary: libstdc++ initialization priority Product: gcc Version: 4.8.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: vhaisman at gmail dot com I am trying to initialize my library early using the `init_priority` attribute. Some paths of my library's initialization might try to print warnings and/or errors. I have hit a SIGSEGV with the following test case, which uses std::cerr. According to some, the library should initialize with priority 101. If this were the case I would expect the test case to work flawlessly. ~~~~ #include struct S1 { S1() { std::cerr << __FUNCTION__ << "\n"; } } static s1 __attribute__ ((__init_priority__ (65535/2))); int main () { return 0; } ~~~~ The stack trace is ~~~~ #0 0x00007ffff7b6a559 in std::ostream::sentry::sentry(std::ostream&) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #1 0x00007ffff7b6ac19 in std::basic_ostream >& std::__ostream_insert >(std::basic_ostream >&, char const*, long) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #2 0x00007ffff7b6b077 in std::basic_ostream >& std::operator<< >(std::basic_ostream >&, char const*) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #3 0x000000000040081d in S1::S1 (this=0x601172 ) at test.cxx:5 #4 0x00000000004007d6 in __static_initialization_and_destruction_0 (__initialize_p=1, __priority=32767) at test.cxx:6 #5 0x00000000004007eb in _GLOBAL__sub_I.32767_main(void) () at test.cxx:13 #6 0x000000000040087d in __libc_csu_init () #7 0x00007ffff7731e55 in __libc_start_main (main=0x40077d , argc=1, argv=0x7fffffffe2c8, init=0x400830 <__libc_csu_init>, fini=, rtld_fini=, stack_end=0x7fffffffe2b8) at libc-start.c:246 #8 0x00000000004006b9 in _start () ~~~~