public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug math/28713] New: GCC 12 miscompiles libm
@ 2021-12-18 23:10 hjl.tools at gmail dot com
2021-12-23 15:43 ` [Bug math/28713] " hjl.tools at gmail dot com
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: hjl.tools at gmail dot com @ 2021-12-18 23:10 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=28713
Bug ID: 28713
Summary: GCC 12 miscompiles libm
Product: glibc
Version: 2.35
Status: NEW
Severity: normal
Priority: P2
Component: math
Assignee: unassigned at sourceware dot org
Reporter: hjl.tools at gmail dot com
Target Milestone: ---
GCC 12 commit:
https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=a84b9d5373c7e67fd0ab2a412c22162cdf969c91
changed the -frounding-math behavior which caused:
FAIL: math/test-float-cos
FAIL: math/test-float-j0
FAIL: math/test-float-jn
FAIL: math/test-float-sin
FAIL: math/test-float-sincos
FAIL: math/test-float-y0
FAIL: math/test-float-y1
FAIL: math/test-float-yn
FAIL: math/test-float32-cos
FAIL: math/test-float32-j0
FAIL: math/test-float32-jn
FAIL: math/test-float32-sin
FAIL: math/test-float32-sincos
FAIL: math/test-float32-y0
FAIL: math/test-float32-y1
FAIL: math/test-float32-yn
on x86-64. The failures look like
testing float (without inline functions)
Failure: cos (qNaN): Exception "Inexact" set
Failure: cos (-qNaN): Exception "Inexact" set
Failure: cos_downward (qNaN): Exception "Inexact" set
Failure: cos_downward (-qNaN): Exception "Inexact" set
Failure: cos_towardzero (qNaN): Exception "Inexact" set
Failure: cos_towardzero (-qNaN): Exception "Inexact" set
Failure: cos_upward (qNaN): Exception "Inexact" set
Failure: cos_upward (-qNaN): Exception "Inexact" set
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug math/28713] GCC 12 miscompiles libm
2021-12-18 23:10 [Bug math/28713] New: GCC 12 miscompiles libm hjl.tools at gmail dot com
@ 2021-12-23 15:43 ` hjl.tools at gmail dot com
2021-12-27 13:39 ` hjl.tools at gmail dot com
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: hjl.tools at gmail dot com @ 2021-12-23 15:43 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=28713
H.J. Lu <hjl.tools at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |2.35
--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> ---
Fixed by
commit 6e30181b4a3ab6c56da0378b65f4d60504982300
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Mon Dec 20 15:00:24 2021 -0800
math: Properly cast X_TLOSS to float [BZ #28713]
Add
#define AS_FLOAT_CONSTANT_1(x) x##f
#define AS_FLOAT_CONSTANT(x) AS_FLOAT_CONSTANT_1(x)
to cast X_TLOSS to float at compile-time to fix:
FAIL: math/test-float-j0
FAIL: math/test-float-jn
FAIL: math/test-float-y0
FAIL: math/test-float-y1
FAIL: math/test-float-yn
FAIL: math/test-float32-j0
FAIL: math/test-float32-jn
FAIL: math/test-float32-y0
FAIL: math/test-float32-y1
FAIL: math/test-float32-yn
when compiling with GCC 12.
Reviewed-by: Paul Zimmermann <Paul.Zimmermann@inria.fr>
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug math/28713] GCC 12 miscompiles libm
2021-12-18 23:10 [Bug math/28713] New: GCC 12 miscompiles libm hjl.tools at gmail dot com
2021-12-23 15:43 ` [Bug math/28713] " hjl.tools at gmail dot com
@ 2021-12-27 13:39 ` hjl.tools at gmail dot com
2022-01-10 14:28 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: hjl.tools at gmail dot com @ 2021-12-27 13:39 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=28713
H.J. Lu <hjl.tools at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> ---
And by
commit d3e4f5a1014db09ff1c62c6506f92cba469e193d
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Mon Dec 20 14:37:26 2021 -0800
s_sincosf.h: Change pio4 type to float [BZ #28713]
s_cosf.c and s_sinf.c have
if (abstop12 (y) < abstop12 (pio4))
where abstop12 takes a float argument, but pio4 is static const double.
pio4 is used only in calls to abstop12 and never in arithmetic. Apply
-static const double pio4 = 0x1.921FB54442D18p-1;
+static const float pio4 = 0x1.921FB6p-1f;
to fix:
FAIL: math/test-float-cos
FAIL: math/test-float-sin
FAIL: math/test-float-sincos
FAIL: math/test-float32-cos
FAIL: math/test-float32-sin
FAIL: math/test-float32-sincos
when compiling with GCC 12.
Reviewed-by: Paul Zimmermann <Paul.Zimmermann@inria.fr>
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug math/28713] GCC 12 miscompiles libm
2021-12-18 23:10 [Bug math/28713] New: GCC 12 miscompiles libm hjl.tools at gmail dot com
2021-12-23 15:43 ` [Bug math/28713] " hjl.tools at gmail dot com
2021-12-27 13:39 ` hjl.tools at gmail dot com
@ 2022-01-10 14:28 ` cvs-commit at gcc dot gnu.org
2022-03-14 12:20 ` jwakely.gcc at gmail dot com
2022-03-14 13:02 ` jwakely.gcc at gmail dot com
4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-01-10 14:28 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=28713
--- Comment #3 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Szabolcs Nagy <nsz@sourceware.org>:
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=347a5b592c91f0230d52a5117fd83e1f75028207
commit 347a5b592c91f0230d52a5117fd83e1f75028207
Author: Szabolcs Nagy <szabolcs.nagy@arm.com>
Date: Fri Dec 31 09:50:50 2021 +0000
math: Fix float conversion regressions with gcc-12 [BZ #28713]
Converting double precision constants to float is now affected by the
runtime dynamic rounding mode instead of being evaluated at compile
time with default rounding mode (except static object initializers).
This can change the computed result and cause performance regression.
The known correctness issues (increased ulp errors) are already fixed,
this patch fixes remaining cases of unnecessary runtime conversions.
Add float M_* macros to math.h as new GNU extension API. To avoid
conversions the new M_* macros are used and instead of casting double
literals to float, use float literals (only required if the conversion
is inexact).
The patch was tested on aarch64 where the following symbols had new
spurious conversion instructions that got fixed:
__clog10f
__gammaf_r_finite@GLIBC_2.17
__j0f_finite@GLIBC_2.17
__j1f_finite@GLIBC_2.17
__jnf_finite@GLIBC_2.17
__kernel_casinhf
__lgamma_negf
__log1pf
__y0f_finite@GLIBC_2.17
__y1f_finite@GLIBC_2.17
cacosf
cacoshf
casinhf
catanf
catanhf
clogf
gammaf_positive
Fixes bug 28713.
Reviewed-by: Paul Zimmermann <Paul.Zimmermann@inria.fr>
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug math/28713] GCC 12 miscompiles libm
2021-12-18 23:10 [Bug math/28713] New: GCC 12 miscompiles libm hjl.tools at gmail dot com
` (2 preceding siblings ...)
2022-01-10 14:28 ` cvs-commit at gcc dot gnu.org
@ 2022-03-14 12:20 ` jwakely.gcc at gmail dot com
2022-03-14 13:02 ` jwakely.gcc at gmail dot com
4 siblings, 0 replies; 6+ messages in thread
From: jwakely.gcc at gmail dot com @ 2022-03-14 12:20 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=28713
Jonathan Wakely <jwakely.gcc at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jwakely.gcc at gmail dot com
--- Comment #4 from Jonathan Wakely <jwakely.gcc at gmail dot com> ---
This breaks any C++ program using those names, e.g. see
https://bugzilla.redhat.com/show_bug.cgi?id=2045149#c6
This is because G++ always defines _GNU_SOURCE.
Was this considered?
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug math/28713] GCC 12 miscompiles libm
2021-12-18 23:10 [Bug math/28713] New: GCC 12 miscompiles libm hjl.tools at gmail dot com
` (3 preceding siblings ...)
2022-03-14 12:20 ` jwakely.gcc at gmail dot com
@ 2022-03-14 13:02 ` jwakely.gcc at gmail dot com
4 siblings, 0 replies; 6+ messages in thread
From: jwakely.gcc at gmail dot com @ 2022-03-14 13:02 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=28713
--- Comment #5 from Jonathan Wakely <jwakely.gcc at gmail dot com> ---
(In reply to Jonathan Wakely from comment #4)
> This breaks any C++ program using those names, e.g. see
> https://bugzilla.redhat.com/show_bug.cgi?id=2045149#c6
>
> This is because G++ always defines _GNU_SOURCE.
>
> Was this considered?
Filed as PR 28963
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-03-14 13:02 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-18 23:10 [Bug math/28713] New: GCC 12 miscompiles libm hjl.tools at gmail dot com
2021-12-23 15:43 ` [Bug math/28713] " hjl.tools at gmail dot com
2021-12-27 13:39 ` hjl.tools at gmail dot com
2022-01-10 14:28 ` cvs-commit at gcc dot gnu.org
2022-03-14 12:20 ` jwakely.gcc at gmail dot com
2022-03-14 13:02 ` jwakely.gcc at gmail dot com
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).