view gcc/testsuite/gcc.dg/pr87052.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 middle-end/87052 - STRING_CST printing incomplete in Gimple dumps
   { dg-do compile }
   { dg-options "-fdump-tree-gimple" } */

void sink (const void*, ...);

void test (void)
{
  const char a[3] = "\000ab";

  /* Expect the following in the dump:
     a = "\x00ab"; */

  const char b[] = { 'a', 0, 'b', 'c' };

  /* Expect the following:
     b = "a\x00bc"; */

  const char c[] = "";

  /* Expect the following:
     c = ""; */

  const char d[0] = { };

  /* Expect the following:
     d = ""; */

  const char e[0] = "";

  /* Expect nothing.  */

  sink (a, b, c, d, e);
}

/* { dg-final { scan-tree-dump-times "a = \"\\\\x00ab\";" 1 "gimple" } }
   { dg-final { scan-tree-dump-times "b = \"a\\\\x00bc\";"  1 "gimple" } }
   { dg-final { scan-tree-dump-times "c = \"\";"  1 "gimple" } }
   { dg-final { scan-tree-dump-times "d = { *};"  1 "gimple" } }
   { dg-final { scan-tree-dump-times "e = "  1 "gimple" } }
   { dg-final { scan-tree-dump-times "e = {CLOBBER}"  1 "gimple" } }  */