[wwwdocs] gcc-13/porting_to.html: Document C++ -fexcess-precision=standard

Message ID ZAB7TAwFGPoJJqHT@tucnak
State Unresolved
Headers
Series [wwwdocs] gcc-13/porting_to.html: Document C++ -fexcess-precision=standard |

Checks

Context Check Description
snail/gcc-patch-check warning Git am fail log

Commit Message

Jakub Jelinek March 2, 2023, 10:32 a.m. UTC
  Hi!

On Fri, Feb 10, 2023 at 10:06:03AM +0100, Gerald Pfeifer wrote:
> Yes, thank you! Two minor suggestions/questions below:
> 
> > --- a/htdocs/gcc-13/changes.html
> > +++ b/htdocs/gcc-13/changes.html
> > +      <code>-fexcess-precision=fast</code>.  The option affects mainly
> 
> Here I'd say "mainly affects".
> 
> > +      IA-32/x86-64 where when defaulting to x87 math and in some cases on
> > +      Motorola 68000 <code>float</code> and <code>double</code> expressions
> > +      are evaluated in <code>long double</code> precision and S/390, System z,
> > +      IBM z Systems where <code>float</code> expressions are evaluated in
> > +      <code>double</code> precision.
> 
> The "where when" part proved a bit tricky for my brain. :-) 
> 
> I think it is precise, but am wondering whether
> 
>   ...IA-32/x64 using x87 math and in some cases on Motorola 68000, where
>   <code>float</code> and <code>double</code> expressions are evaluated...
> 
> might work? What do you think?

Thanks, committed with those tweaks.

Martin would like to see some note in porting_to.html for it too,
here is my attempt to do so:



	Jakub
  

Comments

Martin Liška March 2, 2023, 12:40 p.m. UTC | #1
On 3/2/23 11:32, Jakub Jelinek wrote:
> Hi!
> 
> On Fri, Feb 10, 2023 at 10:06:03AM +0100, Gerald Pfeifer wrote:
>> Yes, thank you! Two minor suggestions/questions below:
>>
>>> --- a/htdocs/gcc-13/changes.html
>>> +++ b/htdocs/gcc-13/changes.html
>>> +      <code>-fexcess-precision=fast</code>.  The option affects mainly
>>
>> Here I'd say "mainly affects".
>>
>>> +      IA-32/x86-64 where when defaulting to x87 math and in some cases on
>>> +      Motorola 68000 <code>float</code> and <code>double</code> expressions
>>> +      are evaluated in <code>long double</code> precision and S/390, System z,
>>> +      IBM z Systems where <code>float</code> expressions are evaluated in
>>> +      <code>double</code> precision.
>>
>> The "where when" part proved a bit tricky for my brain. :-) 
>>
>> I think it is precise, but am wondering whether
>>
>>   ...IA-32/x64 using x87 math and in some cases on Motorola 68000, where
>>   <code>float</code> and <code>double</code> expressions are evaluated...
>>
>> might work? What do you think?
> 
> Thanks, committed with those tweaks.
> 
> Martin would like to see some note in porting_to.html for it too,
> here is my attempt to do so:

I like the suggested wording. Thanks for it.

Martin

> 
> diff --git a/htdocs/gcc-13/porting_to.html b/htdocs/gcc-13/porting_to.html
> index 9a9a3147..5cbeefb6 100644
> --- a/htdocs/gcc-13/porting_to.html
> +++ b/htdocs/gcc-13/porting_to.html
> @@ -120,5 +120,29 @@ the operand as an lvalue.<br>
>     }
>  </code></pre>
>  
> +<h3 id="excess-precision">Excess precision changes</h3>
> +<p>GCC 13 implements in C++ <a href="changes.html#cxx">excess precision support</a>
> +which has been implemented just in the C front-end before.  The new behavior is
> +enabled by default in <code>-std=c++</code><em>NN</em> modes and when
> +<code>FLT_EVAL_METHOD</code> is 1 or 2 affects behavior of floating point
> +constants and expressions.  E.g. for <code>FLT_EVAL_METHOD</code> equal
> +to 2 on ia32:
> +
> +<pre><code>
> +#include <stdlib.h>
> +void foo (void) { if (1.1f + 3.3f != 1.1L + 3.3L) abort (); }
> +void bar (void) { double d = 4.2; if (d == 4.2) abort (); }
> +</code></pre>
> +
> +will not abort with standard excess precision, because constants and expressions
> +in <code>float</code> or <code>double</code> are evaluated in precision of
> +<code>long double</code> and demoted only on casts or assignments, but will
> +abort with fast excess precision, where whether something is evaluated in
> +precision of <code>long double</code> or not depends on what evaluations are
> +done in the i387 floating point stack or are spilled from it.
> +
> +The <code>-fexcess-precision=fast</code> option can be used to request the
> +previous behavior.
> +
>  </body>
>  </html>
> 
> 
> 	Jakub
>
  
Gerald Pfeifer March 2, 2023, 11:05 p.m. UTC | #2
On Thu, 2 Mar 2023, Jakub Jelinek wrote:
> +<pre><code>
> +#include <stdlib.h>

Oops, in HTML we need to spell "<" as "&lt;" and ">" as "&gt; - otherwise
the above would be seen as a tag by the name of stdlib.h. ;-)

I pushed the follow-up patch below.

Gerald


commit 935fcdebfb2fb4dcd89edb51ebed5f1be0fb41e5
Author: Gerald Pfeifer <gerald@pfeifer.com>
Date:   Thu Mar 2 23:58:29 2023 +0100

    gcc-13: Use &lt; and &gt; where necessary

diff --git a/htdocs/gcc-13/porting_to.html b/htdocs/gcc-13/porting_to.html
index f0ccef69..953e1453 100644
--- a/htdocs/gcc-13/porting_to.html
+++ b/htdocs/gcc-13/porting_to.html
@@ -129,7 +129,7 @@ constants and expressions.  E.g. for <code>FLT_EVAL_METHOD</code> equal
 to 2 on ia32:
 
 <pre><code>
-#include <stdlib.h>
+#include &lt;stdlib.h&gt;
 void foo (void) { if (1.1f + 3.3f != 1.1L + 3.3L) abort (); }
 void bar (void) { double d = 4.2; if (d == 4.2) abort (); }
 </code></pre>
  
Jakub Jelinek March 2, 2023, 11:16 p.m. UTC | #3
On Fri, Mar 03, 2023 at 12:05:09AM +0100, Gerald Pfeifer wrote:
> On Thu, 2 Mar 2023, Jakub Jelinek wrote:
> > +<pre><code>
> > +#include <stdlib.h>
> 
> Oops, in HTML we need to spell "<" as "&lt;" and ">" as "&gt; - otherwise
> the above would be seen as a tag by the name of stdlib.h. ;-)
> 
> I pushed the follow-up patch below.

Oops, missed that.  Thanks.

	Jakub
  
Gerald Pfeifer March 9, 2023, 7:09 a.m. UTC | #4
On Thu, 2 Mar 2023, Jakub Jelinek wrote:
> --- a/htdocs/gcc-13/porting_to.html
> +++ b/htdocs/gcc-13/porting_to.html

> +<p>GCC 13 implements in C++ <a href="changes.html#cxx">excess precision support</a>
> +which has been implemented just in the C front-end before.  The new behavior is
> +enabled by default in <code>-std=c++</code><em>NN</em> modes and when
> +<code>FLT_EVAL_METHOD</code> is 1 or 2 affects behavior of floating point
                                               ^^^^^^
> +constants and expressions.  E.g. for <code>FLT_EVAL_METHOD</code> equal
> +to 2 on ia32:

:

> +will not abort with standard excess precision, because constants and expressions
> +in <code>float</code> or <code>double</code> are evaluated in precision of
> +<code>long double</code> and demoted only on casts or assignments, but will
> +abort with fast excess precision, where whether something is evaluated in
> +precision of <code>long double</code> or not depends on what evaluations are
> +done in the i387 floating point stack or are spilled from it.
> +
> +The <code>-fexcess-precision=fast</code> option can be used to request the
> +previous behavior.

I struggled a bit understanding this and so have come up with what I 
hope is simpler (without changing the meaning).

What do you think of the change below?

Gerald


diff --git a/htdocs/gcc-13/porting_to.html b/htdocs/gcc-13/porting_to.html
index 170da096..8a2822ff 100644
--- a/htdocs/gcc-13/porting_to.html
+++ b/htdocs/gcc-13/porting_to.html
@@ -122,12 +122,14 @@ the operand as an lvalue.<br>
 
 <h3 id="excess-precision">Excess precision changes</h3>
 
-<p>GCC 13 implements in C++ <a href="changes.html#cxx">excess precision support</a>
-which has been before implemented just in the C front end.  The new behavior is
-enabled by default in <code>-std=c++</code><em>NN</em> modes and e.g. when
-<code>FLT_EVAL_METHOD</code> is 1 or 2 affects behavior of floating point
-constants and expressions.  E.g. for <code>FLT_EVAL_METHOD</code> equal
-to 2 on ia32:
+<p>GCC 13 implements <a href="changes.html#cxx">excess precision
+support</a>, which was implemented just in the C front end
+before, in C++. The new behavior is enabled by default in
+<code>-std=c++</code><em>NN</em> modes and when
+<code>FLT_EVAL_METHOD</code> is 1 or 2 and affects the behavior of
+floating point constants and expressions.</p>
+
+<p>E.g. for <code>FLT_EVAL_METHOD</code> equal to 2 on ia32
 
 <pre><code>
 #include &lt;stdlib.h&gt;
@@ -139,11 +141,11 @@ will not abort with standard excess precision, because constants and expressions
 in <code>float</code> or <code>double</code> are evaluated in precision of
 <code>long double</code> and demoted only on casts or assignments, but will
 abort with fast excess precision, where whether something is evaluated in
-precision of <code>long double</code> or not depends on what evaluations are
-done in the i387 floating point stack or are spilled from it.
+<code>long double</code> precision depends on what evaluations are
+done in the i387 floating point stack or are spilled from it.</p>
 
-The <code>-fexcess-precision=fast</code> option can be used to request the
-previous behavior.
+</p>The <code>-fexcess-precision=fast</code> option can be used to
+request the previous behavior.</p>
 
 <h3 id="alloc-rebind">allocator_traits&lt;A&gt;::rebind_alloc&lt;A::value_type&gt; must be A</h3>
  
Jakub Jelinek March 9, 2023, 8:05 a.m. UTC | #5
On Thu, Mar 09, 2023 at 08:09:02AM +0100, Gerald Pfeifer wrote:
> I struggled a bit understanding this and so have come up with what I 
> hope is simpler (without changing the meaning).
> 
> What do you think of the change below?

LGTM, thanks.
> 
> diff --git a/htdocs/gcc-13/porting_to.html b/htdocs/gcc-13/porting_to.html
> index 170da096..8a2822ff 100644
> --- a/htdocs/gcc-13/porting_to.html
> +++ b/htdocs/gcc-13/porting_to.html
> @@ -122,12 +122,14 @@ the operand as an lvalue.<br>
>  
>  <h3 id="excess-precision">Excess precision changes</h3>
>  
> -<p>GCC 13 implements in C++ <a href="changes.html#cxx">excess precision support</a>
> -which has been before implemented just in the C front end.  The new behavior is
> -enabled by default in <code>-std=c++</code><em>NN</em> modes and e.g. when
> -<code>FLT_EVAL_METHOD</code> is 1 or 2 affects behavior of floating point
> -constants and expressions.  E.g. for <code>FLT_EVAL_METHOD</code> equal
> -to 2 on ia32:
> +<p>GCC 13 implements <a href="changes.html#cxx">excess precision
> +support</a>, which was implemented just in the C front end
> +before, in C++. The new behavior is enabled by default in
> +<code>-std=c++</code><em>NN</em> modes and when
> +<code>FLT_EVAL_METHOD</code> is 1 or 2 and affects the behavior of
> +floating point constants and expressions.</p>
> +
> +<p>E.g. for <code>FLT_EVAL_METHOD</code> equal to 2 on ia32
>  
>  <pre><code>
>  #include &lt;stdlib.h&gt;
> @@ -139,11 +141,11 @@ will not abort with standard excess precision, because constants and expressions
>  in <code>float</code> or <code>double</code> are evaluated in precision of
>  <code>long double</code> and demoted only on casts or assignments, but will
>  abort with fast excess precision, where whether something is evaluated in
> -precision of <code>long double</code> or not depends on what evaluations are
> -done in the i387 floating point stack or are spilled from it.
> +<code>long double</code> precision depends on what evaluations are
> +done in the i387 floating point stack or are spilled from it.</p>
>  
> -The <code>-fexcess-precision=fast</code> option can be used to request the
> -previous behavior.
> +</p>The <code>-fexcess-precision=fast</code> option can be used to
> +request the previous behavior.</p>
>  
>  <h3 id="alloc-rebind">allocator_traits&lt;A&gt;::rebind_alloc&lt;A::value_type&gt; must be A</h3>
>  

	Jakub
  

Patch

diff --git a/htdocs/gcc-13/porting_to.html b/htdocs/gcc-13/porting_to.html
index 9a9a3147..5cbeefb6 100644
--- a/htdocs/gcc-13/porting_to.html
+++ b/htdocs/gcc-13/porting_to.html
@@ -120,5 +120,29 @@  the operand as an lvalue.<br>
    }
 </code></pre>
 
+<h3 id="excess-precision">Excess precision changes</h3>
+<p>GCC 13 implements in C++ <a href="changes.html#cxx">excess precision support</a>
+which has been implemented just in the C front-end before.  The new behavior is
+enabled by default in <code>-std=c++</code><em>NN</em> modes and when
+<code>FLT_EVAL_METHOD</code> is 1 or 2 affects behavior of floating point
+constants and expressions.  E.g. for <code>FLT_EVAL_METHOD</code> equal
+to 2 on ia32:
+
+<pre><code>
+#include <stdlib.h>
+void foo (void) { if (1.1f + 3.3f != 1.1L + 3.3L) abort (); }
+void bar (void) { double d = 4.2; if (d == 4.2) abort (); }
+</code></pre>
+
+will not abort with standard excess precision, because constants and expressions
+in <code>float</code> or <code>double</code> are evaluated in precision of
+<code>long double</code> and demoted only on casts or assignments, but will
+abort with fast excess precision, where whether something is evaluated in
+precision of <code>long double</code> or not depends on what evaluations are
+done in the i387 floating point stack or are spilled from it.
+
+The <code>-fexcess-precision=fast</code> option can be used to request the
+previous behavior.
+
 </body>
 </html>