summaryrefslogtreecommitdiff
path: root/support/regression/tests/gcc-torture-execute-20000801-4.c
blob: 8b20806a4a0a341dd7d6b9baefec6a7fd5e51a79 (plain) (blame)
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
/*
   20000801-4.c from the execute part of the gcc torture tests.
 */

#include <testfwk.h>

#ifdef __SDCC
#pragma std_c99
#endif

/* Origin: PR c/128 from Martin Sebor <sebor@roguewave.com>, adapted
   as a testcase by Joseph Myers <jsm28@cam.ac.uk>.
*/
/* Character arrays initialized by a string literal must have
   uninitialized elements zeroed.  This isn't clear in the 1990
   standard, but was fixed in TC2 and C99; see DRs #060, #092.
*/

int
foo (void)
{
  char s[2] = "";
  return 0 == s[1];
}

char *t;

void
testTortureExecute (void)
{
  {
    char s[] = "x";
    t = s;
  }
  if (foo ())
    return;
  else
    ASSERT (0);
}