[Bug c++/108934] [12/13 Regression] bit_cast'ing to long double errors out with "the argument cannot be interpreted" since gcc-12

2023-03-02 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108934

--- Comment #7 from CVS Commits  ---
The master branch has been updated by Jakub Jelinek :

https://gcc.gnu.org/g:cc88366a80e35b3e53141f49d3071010ff3c2ef8

commit r13-6408-gcc88366a80e35b3e53141f49d3071010ff3c2ef8
Author: Jakub Jelinek 
Date:   Thu Mar 2 09:27:40 2023 +0100

fold-const: Ignore padding bits in native_interpret_expr REAL_CST reverse
verification [PR108934]

In the following testcase we try to std::bit_cast a (pair of) integral
value(s) which has some non-zero bits in the place of x86 long double
(for 64-bit 16 byte type with 10 bytes actually loaded/stored by hw,
for 32-bit 12 byte) and starting with my PR104522 change we reject that
as native_interpret_expr fails on it.  The PR104522 change extends what
has been done before for MODE_COMPOSITE_P (but those don't have any padding
bits) to all floating point types, because e.g. the exact x86 long double
has various bit combinations we don't support, like
pseudo-(denormals,infinities,NaNs) or unnormals.  The HW handles some of
those as exceptional cases and others similarly to the non-pseudo ones.
But for the padding bits it actually doesn't load/store those bits at all,
it loads/stores 10 bytes.  So, I think we should exempt the padding bits
from the reverse comparison (the native_encode_expr bits for the padding
will be all zeros), which the following patch does.  For bit_cast it is
similar to e.g. ignoring padding bits if the destination is a structure
which has padding bits in there.

The change changed auto-init-4.c to how it has been behaving before the
PR105259 change, where some more VCEs can be now done.

2023-03-02  Jakub Jelinek  

PR c++/108934
* fold-const.cc (native_interpret_expr) : Before
memcmp
comparison copy the bytes from ptr to a temporary buffer and
clearing
padding bits in there.

* gcc.target/i386/auto-init-4.c: Revert PR105259 change.
* g++.target/i386/pr108934.C: New test.

[Bug c++/108934] [12/13 Regression] bit_cast'ing to long double errors out with "the argument cannot be interpreted" since gcc-12

2023-03-01 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108934

Jakub Jelinek  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |jakub at gcc dot gnu.org

--- Comment #6 from Jakub Jelinek  ---
Created attachment 54566
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54566&action=edit
gcc13-pr108934.patch

Untested fix.

[Bug c++/108934] [12/13 Regression] bit_cast'ing to long double errors out with "the argument cannot be interpreted" since gcc-12

2023-03-01 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108934

Jakub Jelinek  changed:

   What|Removed |Added

   Priority|P3  |P2
   Target Milestone|--- |12.3

[Bug c++/108934] [12/13 Regression] bit_cast'ing to long double errors out with "the argument cannot be interpreted" since gcc-12

2023-03-01 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108934

Jakub Jelinek  changed:

   What|Removed |Added

 Ever confirmed|0   |1
   Last reconfirmed||2023-03-01
Summary|bit_cast'ing to long double |[12/13 Regression]
   |errors out with "the|bit_cast'ing to long double
   |argument cannot be  |errors out with "the
   |interpreted" since gcc-12   |argument cannot be
   ||interpreted" since gcc-12
 Status|UNCONFIRMED |NEW