view gcc/testsuite/gcc.dg/pr83801.c @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 84e7813d76e9
children
line wrap: on
line source

/* PR c/83801 */
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-original" } */

static const char a[] = "01234567890123456789012345678901234567890123456789012345678901234567890123456789";
static const char b = a[27];
struct S { const char c[30]; const char d[30]; };
static const struct S e[] = { { "01234567890123456789012345678", "90123456789012345678901234567" },
                              { "89012345678901234567890123456", "78901234567890123456789012345" } };
static const char f = e[1].c[4];

char
foo (int i)
{
  return a[i];
}

char
bar (int i)
{
  return e[0].d[i];
}

/* { dg-final { scan-tree-dump {a\[i]} "original" } } */
/* { dg-final { scan-tree-dump-not {"01234567890123456789012345678901234567890123456789012345678901234567890123456789"\[i]} "original" } } */
/* { dg-final { scan-tree-dump {e\[0]\.d\[i]} "original" } } */
/* { dg-final { scan-tree-dump-not {"90123456789012345678901234567"\[i]} "original" } } */