This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/80364] New: sanitizer detects signed integer overflow in gimple-ssa-sprintf.c
- From: "zeccav at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 08 Apr 2017 04:33:23 +0000
- Subject: [Bug c/80364] New: sanitizer detects signed integer overflow in gimple-ssa-sprintf.c
- Auto-submitted: auto-generated
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);
}