summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/Wstrict-overflow-17.c
blob: 5625bc2a7f3c74a01a8d6f960c96bf5c151acc88 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* { dg-do compile } */
/* { dg-options "-fstrict-overflow -O2 -Wstrict-overflow" } */

/* This erroneously gave an overflow warning.  */

extern void bar (char);
void
foo (char *s)
{
  int len, i;

  for (len = 1; len < 5000; ++len)
    {
      for (i = 0; i < len; ++i)
	{
	  if (s[i] != '\0')
	    bar (s[i]);
	}
    }
}