1 /* { dg-do run { target lto } }
2 * { dg-options "-std=gnu23 -flto -O2" }
5 /* These tests check that incompatible definitions of
6 tagged types can be assumed not to alias and that
7 this is exploited during optimization with LTO. */
11 [[gnu::noinline
,gnu::noipa
]]
12 int test_foo1(struct foo
* a
, void* b
)
16 struct foo
{ int x
; int y
; }* p
= b
;
22 [[gnu::noinline
,gnu::noipa
]]
23 int test_foo2(struct foo
* a
, void* b
)
27 struct fox
{ int x
; }* p
= b
;
34 /* While these tests check that incompatible definitions
35 * of enums can alias. */
37 enum bar
{ A
= 1, B
= 3, C
= 5, D
= 9 };
39 [[gnu::noinline
,gnu::noipa
]]
40 int test_bar1(enum bar
* a
, void* b
)
44 enum bar
{ A
= 1, B
= 3, C
= 6, D
= 9 }* p
= b
;
50 [[gnu::noinline
,gnu::noipa
]]
51 int test_bar2(enum bar
* a
, void* b
)
55 enum baX
{ A
= 1, B
= 3, C
= 5, D
= 9 }* p
= b
;
66 if (1 != test_foo1(&y
, &y
))
69 if (1 != test_foo2(&y
, &y
))
74 if (B
!= test_bar1(&z
, &z
))
77 if (B
!= test_bar2(&z
, &z
))