[Bug c++/108285] [13 Regression] error: conversion from ‘long double’ to ‘double’ may change value [-Werror=float-conversion] since r13-3291-g16ec267063c8ce60
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108285 Jakub Jelinek changed: What|Removed |Added Resolution|--- |FIXED Status|ASSIGNED|RESOLVED --- Comment #4 from Jakub Jelinek --- Fixed.
[Bug c++/108285] [13 Regression] error: conversion from ‘long double’ to ‘double’ may change value [-Werror=float-conversion] since r13-3291-g16ec267063c8ce60
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108285 --- Comment #3 from CVS Commits --- The master branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:3456db4de8940235b303ca38a689353854c9239f commit r13-5152-g3456db4de8940235b303ca38a689353854c9239f Author: Jakub Jelinek 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 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.
[Bug c++/108285] [13 Regression] error: conversion from ‘long double’ to ‘double’ may change value [-Werror=float-conversion] since r13-3291-g16ec267063c8ce60
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108285 Jakub Jelinek 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 --- Created attachment 54239 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54239&action=edit gcc13-pr108285.patch Untested fix.
[Bug c++/108285] [13 Regression] error: conversion from ‘long double’ to ‘double’ may change value [-Werror=float-conversion] since r13-3291-g16ec267063c8ce60
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108285 Richard Biener changed: What|Removed |Added Priority|P3 |P1
[Bug c++/108285] [13 Regression] error: conversion from ‘long double’ to ‘double’ may change value [-Werror=float-conversion] since r13-3291-g16ec267063c8ce60
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108285 Andrew Pinski changed: What|Removed |Added Target||i?86 --- Comment #1 from Andrew Pinski --- 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).
[Bug c++/108285] [13 Regression] error: conversion from ‘long double’ to ‘double’ may change value [-Werror=float-conversion] since r13-3291-g16ec267063c8ce60
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108285 Martin Liška changed: What|Removed |Added Last reconfirmed||2023-01-04 Ever confirmed|0 |1 Status|UNCONFIRMED |NEW Target Milestone|--- |13.0