aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gm2/cse/pass/testcse4.c
blob: 308a9602e35a007904cf162e165bc179dcda728c (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
42
43
44
45
46
47
48
void *alloca (unsigned int);
void memcpy(void *, void *, unsigned int);
void write (int, void *, int);

#define nul  (char)0
struct m2string {
  char *contents;
  int HIGH;
};

struct m2string at_start = { "hello", 5 };

static int StrLen (struct m2string a)
{
  int high, len;
  char *copy;  
  char **T25;

  copy = alloca(a.HIGH+1);
  memcpy(a.contents, copy, a.HIGH+1);
  a.contents = copy;
#if 0
  len = 0;
  high = a.HIGH;
#endif
  
  T25 = (char **)&a;
#if 0
  /* (a.contents[len] != nul) */
  while ((len <= high) && ((*T24)[len] != nul))
    len++;

  return len;
#endif
  (*T25)[0] = 'a';
  return 0;
}

void init (void)
{
  struct m2string b;

  b.contents = "hello";
  b.HIGH = 4;
  if (StrLen(b) == 5)
    write(1, "works\n", 6);
}