[Bug middle-end/105533] UBSAN: gcc/expmed.cc:3272:26: runtime error: signed integer overflow: -9223372036854775808 - 1 cannot be represented in type 'long int'
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Mar 6 13:37:07 GMT 2024
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105533
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Testcase for the first compile time UB (-O3):
long long a, b, c;
void
foo (long long e)
{
long long d = a & 9223372036854775808ULL;
c = b;
if (d && e)
c = c | d;
}
Testcase for the second compile time UB (-O2):
int a[64];
int p;
void
foo (void)
{
int stack_elt = 1;
while (p)
{
stack_elt -= 11;
a[stack_elt] != 0;
}
}
More information about the Gcc-bugs
mailing list