PR tree-optimization/81303
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / pr33172.c
blob79e1810d01dff78be1d6301715e9f5f962cd7e9e
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-tree-optimized" } */
4 struct abc {
5 void (*abc_call)(void);
6 };
8 /*
9 * Use only any one of the three definitions below at a time:
11 * 1. nothing optimized away. Good.
12 * 2. call_func() _not_ optimized away, but struct xyz is. gcc disappoints.
13 * 3. both call_func() and struct xyz optimized away. Nice.
16 /* 1 */
17 /*extern int do_register(struct abc *xyz);*/
19 /* 2 */
20 static inline int do_register(struct abc *xyz)
22 return 0;
25 /* 3 */
26 /*#define do_register(xyz) do { (void)(xyz); } while (0)*/
28 static void call_func(void)
32 static struct abc xyz = {
33 .abc_call = call_func,
36 void func(void)
38 do_register(&xyz);
41 /* { dg-final { scan-tree-dump-not "call_func" "optimized"} } */