aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr92493.c
blob: d301300c9031c7ca05f0cc6fee7b09a99615c2ed (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
/* PR middle-end/92493 - ICE in get_origin_and_offset at gimple-ssa-sprintf.c
   { dg-do compile }
   { dg-options "-O3 -Wall" } */

struct A
{
  int i;
  char a[2];
} *p;

struct B
{
  short j;
  struct A a;
} b;

void warn (int j)
{
  struct A *q = &b.a;
  p = q + j;
  __builtin_snprintf (p->a, 8, "%s", p->a);   // { dg-warning "\\\[-Wrestrict" }
}

void nowarn (char *d, int j)
{
  struct A *q = &b.a;
  p = q + j;
  __builtin_snprintf (d, 8, "%s", p->a);
}