public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/91292] Mangler incorrectly handles negative numbers in expressions Date: Wed, 06 Oct 2021 14:15:41 +0000 [thread overview] Message-ID: <bug-91292-4-gcb6R5OSpf@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-91292-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91292 --- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-11 branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>: https://gcc.gnu.org/g:1682576e62d41cd761472943372b83aee514254a commit r11-9083-g1682576e62d41cd761472943372b83aee514254a Author: Patrick Palka <ppalka@redhat.com> 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)
prev parent reply other threads:[~2021-10-06 14:15 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <bug-91292-4@http.gcc.gnu.org/bugzilla/> 2021-09-24 15:55 ` ppalka at gcc dot gnu.org 2021-09-24 16:11 ` ppalka at gcc dot gnu.org 2021-09-24 16:13 ` ppalka at gcc dot gnu.org 2021-09-24 16:36 ` cvs-commit at gcc dot gnu.org 2021-09-24 21:03 ` richard-gccbugzilla at metafoo dot co.uk 2021-09-27 13:50 ` ppalka at gcc dot gnu.org 2021-10-06 14:15 ` cvs-commit at gcc dot gnu.org [this message]
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-91292-4-gcb6R5OSpf@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).