cgraph: A COMDAT decl always has non-zero address.
[gcc.git] / gcc / testsuite / c-c++-common / pr33763.c
1 /* PR tree-optimization/33763 */
2 /* { dg-do compile } */
3 /* { dg-options "-O2" } */
4
5 typedef struct
6 {
7 void *a;
8 void *b;
9 } T;
10 extern void *foo (const char *, const char *);
11 extern void *bar (void *, const char *, T);
12 extern int baz (const char *, int);
13
14 extern inline __attribute__ ((always_inline, gnu_inline)) int
15 baz (const char *x, int y)
16 {
17 return 2;
18 }
19
20 int
21 baz (const char *x, int y)
22 {
23 return 1;
24 }
25
26 int xa, xb;
27
28 static void *
29 inl (const char *x, const char *y)
30 {
31 T t = { &xa, &xb };
32 int *f = (int *) __builtin_malloc (sizeof (int));
33 const char *z;
34 int o = 0;
35 void *r = 0;
36
37 for (z = y; *z; z++)
38 {
39 if (*z == 'r')
40 o |= 1;
41 if (*z == 'w')
42 o |= 2;
43 }
44 if (o == 1)
45 *f = baz (x, 0);
46 if (o == 2)
47 *f = baz (x, 1);
48 if (o == 3)
49 *f = baz (x, 2);
50
51 if (o && *f > 0)
52 r = bar (f, "w", t);
53 return r;
54 }
55
56 void *
57 foo (const char *x, const char *y)
58 {
59 return inl (x, y);
60 }