1 // { dg-do compile }
2 // { dg-options "-fno-short-enums" }
3
4 typedef union tree_node *tree;
5 typedef union gimple_statement_d *gimple;
6 struct vec_prefix { unsigned num_; };
7 template<typename T> struct vec_t {
8 unsigned length (void) const;
9 T &operator[] (unsigned);
10 vec_prefix prefix_;
11 T vec_[1];
12 };
length(void)13 template<typename T> inline unsigned vec_t<T>::length (void) const {
14 return prefix_.num_;
15 }
16 template<typename T> T & vec_t<T>::operator[] (unsigned ix) {
17 ((void)(__builtin_expect(!(ix < prefix_.num_), 0) ? __builtin_unreachable(), 0 : 0));
18 return vec_[ix];
19 }
20 enum tree_code { PARM_DECL };
21 struct tree_base {
22 enum tree_code code : 16;
23 unsigned default_def_flag : 1;
24 };
25 union tree_node {
26 struct tree_base base;
27 };
28 struct ipa_param_descriptor {
29 tree decl;
30 unsigned used : 1;
31 };
32 typedef struct ipa_param_descriptor ipa_param_descriptor_t;
33 struct ipa_node_params {
34 vec_t<ipa_param_descriptor_t> *descriptors;
35 };
ipa_get_param_count(struct ipa_node_params * info)36 static inline int ipa_get_param_count (struct ipa_node_params *info) {
37 return ((info->descriptors) ? (info->descriptors)->length () : 0);
38 }
ipa_get_param(struct ipa_node_params * info,int i)39 static inline tree ipa_get_param (struct ipa_node_params *info, int i) {
40 return ((*(info->descriptors))[i]).decl;
41 }
ipa_set_param_used(struct ipa_node_params * info,int i,bool val)42 static inline void ipa_set_param_used (struct ipa_node_params *info, int i, bool val) {
43 ((*(info->descriptors))[i]).used = val;
44 }
ipa_get_param_decl_index(struct ipa_node_params * info,tree ptree)45 int ipa_get_param_decl_index (struct ipa_node_params *info, tree ptree)
46 {
47 int i, count;
48 count = ipa_get_param_count (info);
49 for (i = 0; i < count; i++)
50 if (ipa_get_param (info, i) == ptree) return i;
51 return -1;
52 }
visit_ref_for_mod_analysis(gimple stmt,tree op,void * data)53 bool visit_ref_for_mod_analysis (gimple stmt __attribute__ ((__unused__)),
54 tree op, void *data)
55 {
56 struct ipa_node_params *info = (struct ipa_node_params *) data;
57 if (op && ((enum tree_code) (op)->base.code) == PARM_DECL)
58 {
59 int index = ipa_get_param_decl_index (info, op);
60 ((void)(__builtin_expect(!(index >= 0), 0) ? __builtin_unreachable(), 0 : 0));
61 ipa_set_param_used (info, index, true);
62 }
63 } // { dg-warning "control reaches end of non-void function" }
64