From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B5D763858D35; Mon, 27 Apr 2020 22:32:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B5D763858D35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1588026751; bh=/3fVDVrigWnbW60muRpKVk+K9c34P+s/7UhStwKZriU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=cq6kLBPnSQrZzcpCDDRe4E2AsrUBxM/HV/GvG9F+PtI/2iIJpMw5twFpzFRLTA7dg E8GbQepzMzqz8bY6HWHOe+zpCrDGiVnhYuOnBF7+f5RGFsyMe1jAI78QLBvWktNKoP 8NtGS8qYnRdbw9+K2+y01utl973R6RmLtY9Zdh70= From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/94810] std::cout segmentation fault in __attribute__((constructor)) function Date: Mon, 27 Apr 2020 22:32:31 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 9.3.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: 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: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2020 22:32:31 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94810 --- Comment #1 from Jonathan Wakely --- Why can't you just use a global object with a constructor and destructor? T= hat would get correctly ordered with respect to the std::ios_base::Init object = that needs to be created before std::cout can be used. The constructor and destructor attributes not necessary in C++, and are documented as having an unspecified order relative to global objects (like = the std::ios_base::Init one).=