summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr87052.c
blob: 2affc480f4e3778b1098b4ad0dd9270a007f14b6 (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
30
31
32
33
34
35
36
37
38
39
40
41
/* 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" } }  */