https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80364
Bug ID: 80364
Summary: sanitizer detects signed integer overflow in
gimple-ssa-sprintf.c
Product: gcc
Version: 7.0.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: zeccav at gmail dot com
Target Milestone: ---
Host: x86_64-pc-linux-gnu
Target: x86_64-pc-linux-gnu
/* from pr72858.c */
/*../../gcc-trunk-246751/gcc/gimple-ssa-sprintf.c:1007:22: runtime error:
negation of -9223372036854775808 cannot be represented in type 'long int [3]';
cast to an unsigned type to negate this value to itself
../../gcc-trunk-246751/gcc/gimple-ssa-sprintf.c:773:7: runtime error: signed
integer overflow: 1 + 9223372036854775807 cannot be represented in type 'long
int [3]'
*/
/* COLLECT_GCC_OPTIONS='-S' '-v' '-mtune=generic' '-march=x86-64' */
#include <stdio.h>
void
test_everything (char *d, long lexpr)
{
sprintf (d, "before %-+*.*lld after", lexpr, lexpr, lexpr);
}