1// { dg-do compile }
2// { dg-options "-fno-short-enums" }
3
4typedef union tree_node *tree;
5typedef union gimple_statement_d *gimple;
6struct vec_prefix { unsigned num_; };
7template<typename T> struct vec_t {
8    unsigned length (void) const;
9    T &operator[] (unsigned);
10    vec_prefix prefix_;
11    T vec_[1];
12};
13template<typename T> inline unsigned vec_t<T>::length (void) const {
14    return prefix_.num_;
15}
16template<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}
20enum tree_code { PARM_DECL };
21struct tree_base {
22    enum tree_code code : 16;
23    unsigned default_def_flag : 1;
24};
25union tree_node {
26    struct tree_base base;
27};
28struct ipa_param_descriptor {
29    tree decl;
30    unsigned used : 1;
31};
32typedef struct ipa_param_descriptor ipa_param_descriptor_t;
33struct ipa_node_params {
34    vec_t<ipa_param_descriptor_t> *descriptors;
35};
36static inline int ipa_get_param_count (struct ipa_node_params *info) {
37    return ((info->descriptors) ? (info->descriptors)->length () : 0);
38}
39static inline tree ipa_get_param (struct ipa_node_params *info, int i) {
40    return ((*(info->descriptors))[i]).decl;
41}
42static inline void ipa_set_param_used (struct ipa_node_params *info, int i, bool val) {
43    ((*(info->descriptors))[i]).used = val;
44}
45int 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}
53bool 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}
64