public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] GCC-13/changes: Add note about iostream usage
@ 2023-04-26 16:53 Andrew Pinski
  2023-04-26 19:06 ` Jonathan Wakely
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Pinski @ 2023-04-26 16:53 UTC (permalink / raw)
  To: gcc-patches; +Cc: Andrew Pinski

This adds a note about iostream usage so it does not catch others
in surpise like it has already.

OK?
---
 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
 <!-- .................................................................. -->
 <h2>Caveats</h2>
 <ul>
+    <li>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.
+     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).  </li>
     <li>OpenMP offloading to Intel MIC has been removed.</li>
     <li>The support for the <code>cr16-elf</code>, <code>tilegx*-linux</code>, <code>tilepro*-linux</code>,
       <code>hppa[12]*-*-hpux10*</code>, <code>hppa[12]*-*-hpux11*</code>
-- 
2.31.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] GCC-13/changes: Add note about iostream usage
  2023-04-26 16:53 [PATCH] GCC-13/changes: Add note about iostream usage Andrew Pinski
@ 2023-04-26 19:06 ` Jonathan Wakely
  2023-04-26 19:10   ` Andrew Pinski
  2023-04-28 12:56   ` [PATCH v2] " Jonathan Wakely
  0 siblings, 2 replies; 4+ messages in thread
From: Jonathan Wakely @ 2023-04-26 19:06 UTC (permalink / raw)
  To: Andrew Pinski; +Cc: gcc-patches

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
> <!-- .................................................................. -->
> <h2>Caveats</h2>
> <ul>
>+    <li>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 <iostream> 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).  </li>

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:

   <li>For C++, construction of the global iostream objects 
   <code>std::cout</code>, <code>std::cin</code> etc. is now done
   inside the standard library, instead of in every source file that
   includes the <code>&lt;iostream&gt;</code> 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
   <code>libstdc++.so</code> is not used at runtime. See the
   <a href="https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dynamic_or_shared.html#manual.intro.using.linkage.dynamic">documentation</a>
   about using the right <code>libstdc++.so</code> at runtime.
   </li>



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] GCC-13/changes: Add note about iostream usage
  2023-04-26 19:06 ` Jonathan Wakely
@ 2023-04-26 19:10   ` Andrew Pinski
  2023-04-28 12:56   ` [PATCH v2] " Jonathan Wakely
  1 sibling, 0 replies; 4+ messages in thread
From: Andrew Pinski @ 2023-04-26 19:10 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: Andrew Pinski, gcc-patches

On Wed, Apr 26, 2023 at 12:07 PM Jonathan Wakely via Gcc-patches
<gcc-patches@gcc.gnu.org> 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
> > <!-- .................................................................. -->
> > <h2>Caveats</h2>
> > <ul>
> >+    <li>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 <iostream> 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).  </li>
>
> 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:
>
>    <li>For C++, construction of the global iostream objects
>    <code>std::cout</code>, <code>std::cin</code> etc. is now done
>    inside the standard library, instead of in every source file that
>    includes the <code>&lt;iostream&gt;</code> 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
>    <code>libstdc++.so</code> is not used at runtime. See the
>    <a href="https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dynamic_or_shared.html#manual.intro.using.linkage.dynamic">documentation</a>
>    about using the right <code>libstdc++.so</code> at runtime.
>    </li>

This looks better than my version.

Thanks,
Andrew

>
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2] GCC-13/changes: Add note about iostream usage
  2023-04-26 19:06 ` Jonathan Wakely
  2023-04-26 19:10   ` Andrew Pinski
@ 2023-04-28 12:56   ` Jonathan Wakely
  1 sibling, 0 replies; 4+ messages in thread
From: Jonathan Wakely @ 2023-04-28 12:56 UTC (permalink / raw)
  To: Andrew Pinski; +Cc: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 2135 bytes --]

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
>><!-- .................................................................. -->
>><h2>Caveats</h2>
>><ul>
>>+    <li>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 <iostream> 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).  </li>
>
>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:
>
>  <li>For C++, construction of the global iostream objects   
><code>std::cout</code>, <code>std::cin</code> etc. is now done
>  inside the standard library, instead of in every source file that
>  includes the <code>&lt;iostream&gt;</code> 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
>  <code>libstdc++.so</code> is not used at runtime. See the
>  <a href="https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dynamic_or_shared.html#manual.intro.using.linkage.dynamic">documentation</a>
>  about using the right <code>libstdc++.so</code> at runtime.
>  </li>

Here's a proper patch proposal along those lines.

OK for wwwdocs?



[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 1488 bytes --]

commit cf408a8d7e9ee3c7efd5b4a3fa5697f4a85a036a
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Fri Apr 28 13:47:12 2023 +0100

    Add caveat about C++ iostream init changes (PR108969)
    
    Co-authored-by: Andrew Pinski <apinski@marvell.com>

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
       <a href="https://gcc.gnu.org/onlinedocs/gcc-13.1.0/gcc/ARM-iWMMXt-Built-in-Functions.html">
       iWMMXt built-in functions</a>.
     </li>
+    <li>For C++, construction of the global iostream objects
+      <code>std::cout</code>, <code>std::cin</code> etc. is now done
+      inside the standard library, instead of in every source file that
+      includes the <code>&lt;iostream&gt;</code> 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
+      <code>libstdc++.so</code> is not used at runtime. See the
+      <a href="https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dynamic_or_shared.html#manual.intro.using.linkage.dynamic">documentation</a>
+      about using the right <code>libstdc++.so</code> at runtime.
+      Future GCC releases will mitigate the problem so that the program
+      cannot be run at all with an older <code>libstdc++.so</code>.
+    </li>
 </ul>
 
 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-04-28 12:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-26 16:53 [PATCH] GCC-13/changes: Add note about iostream usage Andrew Pinski
2023-04-26 19:06 ` Jonathan Wakely
2023-04-26 19:10   ` Andrew Pinski
2023-04-28 12:56   ` [PATCH v2] " Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).