view gcc/testsuite/gcc.dg/pr92493.c @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents
children
line wrap: on
line source

/* 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);
}