From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id C99483857738 for ; Fri, 28 Apr 2023 12:56:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C99483857738 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682686601; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=0axsfOaP7vbLgSSTPItJLQ/9iQF3FkMjf4QNDCGYYzc=; b=WUyyN7HFbkFXpwsQ9Ak9AWUPBMvP1hFL39DgfyaHIxik46uP8W4TebFKugG2XrDPKIht7h m8xL/VE++C6bxr+kax1iHHVY9qdIaMDgex14WNafG2fSgmhku/3a6BWjfFMzEwcEVpUWEX FOXlIUrHqeoYPB1bPgbakL0PmmNFB8Y= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-244-qixVkrLCN1m9lV2e45km4A-1; Fri, 28 Apr 2023 08:56:40 -0400 X-MC-Unique: qixVkrLCN1m9lV2e45km4A-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id ACB03185A790; Fri, 28 Apr 2023 12:56:39 +0000 (UTC) Received: from localhost (unknown [10.42.28.201]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6DB3040C2064; Fri, 28 Apr 2023 12:56:39 +0000 (UTC) Date: Fri, 28 Apr 2023 13:56:37 +0100 From: Jonathan Wakely To: Andrew Pinski Cc: gcc-patches@gcc.gnu.org Subject: [PATCH v2] GCC-13/changes: Add note about iostream usage Message-ID: References: <20230426165347.599616-1-apinski@marvell.com> MIME-Version: 1.0 In-Reply-To: X-Clacks-Overhead: GNU Terry Pratchett X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/mixed; boundary="+jTGUMJK2nSX9GXX" Content-Disposition: inline X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --+jTGUMJK2nSX9GXX Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline On 26/04/23 20:06 +0100, Jonathan Wakely wrote: >On 26/04/23 09:53 -0700, Andrew Pinski wrote: >>This adds a note about iostream usage so it does not catch others >>in surpise like it has already. >> >>OK? > >Thanks, I agree we should add something, but have some comments below. > >>--- >>htdocs/gcc-13/changes.html | 5 +++++ >>1 file changed, 5 insertions(+) >> >>diff --git a/htdocs/gcc-13/changes.html b/htdocs/gcc-13/changes.html >>index 70732ec0..7c83f7c4 100644 >>--- a/htdocs/gcc-13/changes.html >>+++ b/htdocs/gcc-13/changes.html >>@@ -25,6 +25,11 @@ You may also want to check out our >> >>

Caveats

>>
    >>+
  • libstdc++ uses constructors inside the library to initialize std::cout/std::cin, etc. >>+ instead of having it done in each source which uses iostream header. > >We should use code font for std::cout, std::cin and iostream, and >style it as not just iostream. > >>+ This requires you to make sure the dynamic loader to load the new libstdc++v3 library >>+ (examples of how to do this is to use -Wl,-rpath,... while linking or LD_LIBRARY_PATH >>+ while running the program).
  • > >I think it would be better to link to https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dynamic_or_shared.html#manual.intro.using.linkage.dynamic > >How about: > >
  • For C++, construction of the global iostream objects >std::cout, std::cin etc. is now done > inside the standard library, instead of in every source file that > includes the <iostream> header. This change > improves the start-up performance of C++ programs, but it means that > code compiled with GCC 13.1 will crash if the correct version of > libstdc++.so is not used at runtime. See the > documentation > about using the right libstdc++.so at runtime. >
  • Here's a proper patch proposal along those lines. OK for wwwdocs? --+jTGUMJK2nSX9GXX Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="patch.txt" commit cf408a8d7e9ee3c7efd5b4a3fa5697f4a85a036a Author: Jonathan Wakely Date: Fri Apr 28 13:47:12 2023 +0100 Add caveat about C++ iostream init changes (PR108969) Co-authored-by: Andrew Pinski diff --git a/htdocs/gcc-13/changes.html b/htdocs/gcc-13/changes.html index 70732ec0..f9533494 100644 --- a/htdocs/gcc-13/changes.html +++ b/htdocs/gcc-13/changes.html @@ -56,6 +56,18 @@ You may also want to check out our iWMMXt built-in functions. +
  • For C++, construction of the global iostream objects + std::cout, std::cin etc. is now done + inside the standard library, instead of in every source file that + includes the <iostream> header. This change + improves the start-up performance of C++ programs, but it means that + code compiled with GCC 13.1 will crash if the correct version of + libstdc++.so is not used at runtime. See the + documentation + about using the right libstdc++.so at runtime. + Future GCC releases will mitigate the problem so that the program + cannot be run at all with an older libstdc++.so. +
--+jTGUMJK2nSX9GXX--