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