public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/108285] New: [13 Regression] error: conversion from ‘long double’ to ‘double’ may change value [-Werror=float-conversion] since r13-3291-g16ec267063c8ce60
@ 2023-01-04 16:28 marxin at gcc dot gnu.org
2023-01-04 16:28 ` [Bug c++/108285] " marxin at gcc dot gnu.org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: marxin at gcc dot gnu.org @ 2023-01-04 16:28 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108285
Bug ID: 108285
Summary: [13 Regression] error: conversion from ‘long double’
to ‘double’ may change value
[-Werror=float-conversion] since
r13-3291-g16ec267063c8ce60
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Keywords: rejects-valid
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: marxin at gcc dot gnu.org
CC: jakub at gcc dot gnu.org
Target Milestone: ---
I noticed libheif package fails due to:
$ cat heif.ii
void lround(double);
void foo(float coeffs) {
lround(2 * coeffs);
}
$ g++ heif.ii -c -m32 -std=c++14 -Werror=float-conversion
heif.ii: In function ‘void foo(float)’:
heif.ii:4:12: error: conversion from ‘long double’ to ‘double’ may change value
[-Werror=float-conversion]
4 | lround(2 * coeffs);
| ~~^~~~~~~~
cc1plus: some warnings being treated as errors
while -m64 is fine:
$ g++ heif.ii -c -std=c++14 -Werror=float-conversion
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/108285] [13 Regression] error: conversion from ‘long double’ to ‘double’ may change value [-Werror=float-conversion] since r13-3291-g16ec267063c8ce60
2023-01-04 16:28 [Bug c++/108285] New: [13 Regression] error: conversion from ‘long double’ to ‘double’ may change value [-Werror=float-conversion] since r13-3291-g16ec267063c8ce60 marxin at gcc dot gnu.org
@ 2023-01-04 16:28 ` marxin at gcc dot gnu.org
2023-01-04 17:21 ` pinskia at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: marxin at gcc dot gnu.org @ 2023-01-04 16:28 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108285
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2023-01-04
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
Target Milestone|--- |13.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/108285] [13 Regression] error: conversion from ‘long double’ to ‘double’ may change value [-Werror=float-conversion] since r13-3291-g16ec267063c8ce60
2023-01-04 16:28 [Bug c++/108285] New: [13 Regression] error: conversion from ‘long double’ to ‘double’ may change value [-Werror=float-conversion] since r13-3291-g16ec267063c8ce60 marxin at gcc dot gnu.org
2023-01-04 16:28 ` [Bug c++/108285] " marxin at gcc dot gnu.org
@ 2023-01-04 17:21 ` pinskia at gcc dot gnu.org
2023-01-09 17:28 ` rguenth at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-01-04 17:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108285
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target| |i?86
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Looks like only a C++ front-end issue with -Wfloat-conversion Which looks like
it ignores the conversion from excess precision .
-xc++ -m32 -fexcess-precision=standard -Werror=float-conversion
is enough to reproduce the warning (converted to error via -Werror).
You might be able to reproduce the issue with 16bit float too on some targets
too ..
(32bit x86 is the only target where 32bit [and 64bit] floating point gets
converted to 80bit float and all).
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/108285] [13 Regression] error: conversion from ‘long double’ to ‘double’ may change value [-Werror=float-conversion] since r13-3291-g16ec267063c8ce60
2023-01-04 16:28 [Bug c++/108285] New: [13 Regression] error: conversion from ‘long double’ to ‘double’ may change value [-Werror=float-conversion] since r13-3291-g16ec267063c8ce60 marxin at gcc dot gnu.org
2023-01-04 16:28 ` [Bug c++/108285] " marxin at gcc dot gnu.org
2023-01-04 17:21 ` pinskia at gcc dot gnu.org
@ 2023-01-09 17:28 ` rguenth at gcc dot gnu.org
2023-01-10 15:58 ` jakub at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-01-09 17:28 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108285
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/108285] [13 Regression] error: conversion from ‘long double’ to ‘double’ may change value [-Werror=float-conversion] since r13-3291-g16ec267063c8ce60
2023-01-04 16:28 [Bug c++/108285] New: [13 Regression] error: conversion from ‘long double’ to ‘double’ may change value [-Werror=float-conversion] since r13-3291-g16ec267063c8ce60 marxin at gcc dot gnu.org
` (2 preceding siblings ...)
2023-01-09 17:28 ` rguenth at gcc dot gnu.org
@ 2023-01-10 15:58 ` jakub at gcc dot gnu.org
2023-01-13 17:24 ` cvs-commit at gcc dot gnu.org
2023-01-13 17:37 ` jakub at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-01-10 15:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108285
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |jakub at gcc dot gnu.org
Status|NEW |ASSIGNED
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 54239
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54239&action=edit
gcc13-pr108285.patch
Untested fix.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/108285] [13 Regression] error: conversion from ‘long double’ to ‘double’ may change value [-Werror=float-conversion] since r13-3291-g16ec267063c8ce60
2023-01-04 16:28 [Bug c++/108285] New: [13 Regression] error: conversion from ‘long double’ to ‘double’ may change value [-Werror=float-conversion] since r13-3291-g16ec267063c8ce60 marxin at gcc dot gnu.org
` (3 preceding siblings ...)
2023-01-10 15:58 ` jakub at gcc dot gnu.org
@ 2023-01-13 17:24 ` cvs-commit at gcc dot gnu.org
2023-01-13 17:37 ` jakub at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-01-13 17:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108285
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:3456db4de8940235b303ca38a689353854c9239f
commit r13-5152-g3456db4de8940235b303ca38a689353854c9239f
Author: Jakub Jelinek <jakub@redhat.com>
Date: Fri Jan 13 18:23:57 2023 +0100
c++: Avoid some false positive -Wfloat-conversion warnings with extended
precision [PR108285]
On the following testcase trunk emits a false positive warning on ia32.
convert_like_internal is there called with type of double and
expr EXCESS_PRECISION_EXPR with float type with long double operand
2.L * (long double) x.
Now, for the code generation we do the right thing, cp_convert
to double from that 2.L * (long double) x, but we call even
cp_convert_and_check with that and that emits the -Wfloat-conversion
warning. Looking at what the C FE does in this case, it calls
convert_and_check with the EXCESS_PRECISION_EXPR expression rather
than its operand, and essentially uses the operand for code generation
and EXCESS_PRECISION_EXPR itself for warnings.
The following patch does that too for the C++ FE.
2023-01-13 Jakub Jelinek <jakub@redhat.com>
PR c++/108285
* cvt.cc (cp_convert_and_check): For EXCESS_PRECISION_EXPR
use its operand except that for warning purposes use the original
EXCESS_PRECISION_EXPR.
* call.cc (convert_like_internal): Only look through
EXCESS_PRECISION_EXPR when calling cp_convert, not when calling
cp_convert_and_check.
* g++.dg/warn/pr108285.C: New test.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/108285] [13 Regression] error: conversion from ‘long double’ to ‘double’ may change value [-Werror=float-conversion] since r13-3291-g16ec267063c8ce60
2023-01-04 16:28 [Bug c++/108285] New: [13 Regression] error: conversion from ‘long double’ to ‘double’ may change value [-Werror=float-conversion] since r13-3291-g16ec267063c8ce60 marxin at gcc dot gnu.org
` (4 preceding siblings ...)
2023-01-13 17:24 ` cvs-commit at gcc dot gnu.org
@ 2023-01-13 17:37 ` jakub at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-01-13 17:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108285
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-01-13 17:37 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-04 16:28 [Bug c++/108285] New: [13 Regression] error: conversion from ‘long double’ to ‘double’ may change value [-Werror=float-conversion] since r13-3291-g16ec267063c8ce60 marxin at gcc dot gnu.org
2023-01-04 16:28 ` [Bug c++/108285] " marxin at gcc dot gnu.org
2023-01-04 17:21 ` pinskia at gcc dot gnu.org
2023-01-09 17:28 ` rguenth at gcc dot gnu.org
2023-01-10 15:58 ` jakub at gcc dot gnu.org
2023-01-13 17:24 ` cvs-commit at gcc dot gnu.org
2023-01-13 17:37 ` jakub at gcc dot gnu.org
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).