summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr33017.c
blob: 851fe71f8607a2f266f2370cc17b720ec71cc3d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/* PR tree-optimization/33017 */
/* { dg-do run } */
/* { dg-options "-O2 -ftree-vectorize" } */

extern __SIZE_TYPE__ strlen (const char *);
extern void abort (void);

char *
__attribute__((noinline))
foo (const char *string)
{
  int len;
  static char var[0x104];
  int off;
  len = strlen (string);
  for (off = 0; off < 64; off++)
    var[len + off + 2] = 0x57;
  return var;
}

int
main (void)
{
  char *p = foo ("abcd");
  int i;
  for (i = 0; i < 0x104; i++)
    if (p[i] != ((i >= 6 && i < 70) ? 0x57 : 0))
      abort ();
  return 0;
}