* gcc.dg/ubsan/static-init-null.c: New testcase
[platform/upstream/gcc.git] / gcc / testsuite / gcc.dg / ubsan / static-init-null.c
1 /* { dg-do compile } */
2 /* { dg-options "-fsanitize=null" } */
3
4 typedef struct a_s a_t;
5 typedef struct b_s b_t;
6
7 struct b_s
8 {
9   int n;
10 };
11
12 struct a_s
13 {
14   int n;
15 };
16
17 static a_t arr[] = {
18   {
19     .n = 1,
20   },
21 };
22
23 __attribute__ ((used)) static b_t inited_struct = {
24   .n = arr == 0 ? 0 : 16 / sizeof (arr[0]),
25 };