This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/47504] some constexpr calculations erroneously overflow when using negative numbers
- From: "jason at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 16 Mar 2011 23:34:28 +0000
- Subject: [Bug c++/47504] some constexpr calculations erroneously overflow when using negative numbers
- Auto-submitted: auto-generated
- References: <bug-47504-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47504
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jason at gcc dot gnu.org,
| |kazu at gcc dot gnu.org
--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> 2011-03-16 23:34:25 UTC ---
This is happening because convert_to_integer is doing what seems to me like an
invalid transformation: it forces the arithmetic to be done in unsigned char,
so we end up with char((unsigned char)-2), or char(254), which has
implementation-defined behavior according to the C and C++ standards.
This seems to have been introduced with the fix for PR 25125.