https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61944
Bug ID: 61944
Summary: loop-iv.c:2610 signed integer overflow
Product: gcc
Version: 4.9.1
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: zeccav at gmail dot com
// from pr42049.c
// gcc -funroll-loops -O
// ../../gcc-4.9.1/gcc/loop-iv.c:2610:14: runtime error:
// signed integer overflow: 7 - -9223372036854775808 cannot be represented in
type 'long int'
// "max = (up - down) / inc + 1;"
extern char *strcpy (char *s1, const char *s2);
struct S { char s[4]; };
int
foo (int x, char **y)
{
struct S s[9];
long i;
for (i = 2; i && i < 8; i++)
strcpy (s[i].s, y[i + 1]);
}