[Bug c++/98216] [C++20] template mangling for double template argument is wrong

2021-10-14 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98216

Andrew Pinski  changed:

   What|Removed |Added

   Target Milestone|--- |11.3

[Bug c++/98216] [C++20] template mangling for double template argument is wrong

2021-10-14 Thread hq.ks at web dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98216

hq.ks at web dot de changed:

   What|Removed |Added

 CC||hq.ks at web dot de

--- Comment #11 from hq.ks at web dot de ---
*** Bug 102754 has been marked as a duplicate of this bug. ***

[Bug c++/98216] [C++20] template mangling for double template argument is wrong

2021-10-06 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98216

--- Comment #10 from CVS Commits  ---
The releases/gcc-11 branch has been updated by Patrick Palka
:

https://gcc.gnu.org/g:1682576e62d41cd761472943372b83aee514254a

commit r11-9083-g1682576e62d41cd761472943372b83aee514254a
Author: Patrick Palka 
Date:   Fri Sep 24 12:36:26 2021 -0400

real: fix encoding of negative IEEE double/quad values [PR98216]

In encode_ieee_double/quad, the assignment

  unsigned long WORD = r->sign << 31;

is intended to set the 31st bit of WORD whenever the sign bit is set.
But on LP64 hosts it also unintentionally sets the upper 32 bits of WORD,
because r->sign gets promoted from unsigned:1 to int and then the result
of the shift (equal to INT_MIN) gets sign extended from int to long.

In the C++ frontend, this bug causes incorrect mangling of negative
floating point values because the output of real_to_target called from
write_real_cst unexpectedly has the upper 32 bits of this word set,
which the caller doesn't mask out.

This patch fixes this by avoiding the unwanted sign extension.  Note
that r0-53976 fixed the same bug in encode_ieee_single long ago.

PR c++/98216
PR c++/91292

gcc/ChangeLog:

* real.c (encode_ieee_double): Avoid unwanted sign extension.
(encode_ieee_quad): Likewise.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/nontype-float2.C: New test.

(cherry picked from commit 34947d4e97ee72b26491cfe5ff4fa8258fadbe95)

[Bug c++/98216] [C++20] template mangling for double template argument is wrong

2021-09-24 Thread emmanuel.le-trong--- via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98216

Emmanuel Le Trong  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED

--- Comment #9 from Emmanuel Le Trong  ---
Fixed, thank you.

[Bug c++/98216] [C++20] template mangling for double template argument is wrong

2021-09-24 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98216

--- Comment #8 from CVS Commits  ---
The master branch has been updated by Patrick Palka :

https://gcc.gnu.org/g:34947d4e97ee72b26491cfe5ff4fa8258fadbe95

commit r12-3882-g34947d4e97ee72b26491cfe5ff4fa8258fadbe95
Author: Patrick Palka 
Date:   Fri Sep 24 12:36:26 2021 -0400

real: fix encoding of negative IEEE double/quad values [PR98216]

In encode_ieee_double/quad, the assignment

  unsigned long WORD = r->sign << 31;

is intended to set the 31st bit of WORD whenever the sign bit is set.
But on LP64 hosts it also unintentionally sets the upper 32 bits of WORD,
because r->sign gets promoted from unsigned:1 to int and then the result
of the shift (equal to INT_MIN) gets sign extended from int to long.

In the C++ frontend, this bug causes incorrect mangling of negative
floating point values because the output of real_to_target called from
write_real_cst unexpectedly has the upper 32 bits of this word set,
which the caller doesn't mask out.

This patch fixes this by avoiding the unwanted sign extension.  Note
that r0-53976 fixed the same bug in encode_ieee_single long ago.

PR c++/98216
PR c++/91292

gcc/ChangeLog:

* real.c (encode_ieee_double): Avoid unwanted sign extension.
(encode_ieee_quad): Likewise.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/nontype-float2.C: New test.

[Bug c++/98216] [C++20] template mangling for double template argument is wrong

2021-09-23 Thread ppalka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98216

Patrick Palka  changed:

   What|Removed |Added

 CC||andrei.popa105 at yahoo dot com

--- Comment #7 from Patrick Palka  ---
*** Bug 102092 has been marked as a duplicate of this bug. ***

[Bug c++/98216] [C++20] template mangling for double template argument is wrong

2021-09-23 Thread ppalka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98216

Patrick Palka  changed:

   What|Removed |Added

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

[Bug c++/98216] [C++20] template mangling for double template argument is wrong

2021-07-27 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98216

Andrew Pinski  changed:

   What|Removed |Added

 CC||bobmiller at nvidia dot com

--- Comment #6 from Andrew Pinski  ---
*** Bug 100279 has been marked as a duplicate of this bug. ***