aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/strlenopt-42.c
blob: 019b89e7568a5d6d3e6b51bd09aa9580686a4f84 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* PR tree-optimization/83781 - Bootstrap failed on x86 with --with-arch=corei7
   --with-cpu=corei7
   Verify that the upper bound of the size of an array of pointers
   to strings isn't considered to be the upper bound of the lengths
   of the pointed-to strings.
   { dg-do compile }
   { dg-options "-O2 -Wall" } */

const char* const ap[32] = { "1", "12", "123" };

char d4[4];
char d7[7];

void nowarn_range_ptr_var_1 (int i)
{
  __builtin_sprintf (d4, "%s", ap[i]);
}

void nowarn_range_ptr_var_2 (int i, int j)
{
  __builtin_sprintf (d7, "%s%s", ap[i], ap[j]);
}