This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/66876] vrp: changing unsigned to signed comparison


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66876

Mikael Pettersson <mikpelinux at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mikpelinux at gmail dot com

--- Comment #1 from Mikael Pettersson <mikpelinux at gmail dot com> ---
Compile with -fsanitize=undefined and you'll get

runtime error: signed integer overflow: 60667 * 65536 cannot be represented in
type 'int'

The "65536 * d[1]" sub-expression is evaluated as int*int->int, so it overflows
and then all bets are off.

Append a U to the 64K literal.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]