1 /* { dg-do compile } */ 2 /* { dg-options "-O2 -w" } */ 3 /* { dg-skip-if "too many arguments in function call" { bpf-*-* } } */ 4 5 /* This file was automatically reduced from tree-ssa-operands.c. It 6 contains many warnings, but it exposes a copy propagation bug that 7 is somewhat difficult to reproduce otherwise. */ 8 9 __extension__ typedef __SIZE_TYPE__ size_t; 10 extern void fancy_abort (const char *, int, const char *) __attribute__ ((__noreturn__)); 11 typedef union tree_node *tree; 12 enum tree_code { 13 TREE_LIST, ARRAY_TYPE, RECORD_TYPE, UNION_TYPE, QUAL_UNION_TYPE, STRING_CST, LT_EXPR, GE_EXPR, LABEL_EXPR, ASM_EXPR, SSA_NAME, }; 14 enum tree_code_class { 15 tcc_type, tcc_reference, tcc_expression }; 16 extern const enum tree_code_class tree_code_type[]; 17 extern const unsigned char tree_code_length[]; 18 struct tree_common { 19 union tree_ann_d *ann; 20 __extension__ enum tree_code code : 8; 21 }; 22 struct tree_string { 23 char str[1]; 24 }; 25 struct tree_list { 26 tree purpose; 27 tree value; 28 }; 29 struct tree_exp { 30 tree operands[1]; 31 }; 32 typedef struct ssa_use_operand_d { 33 struct ssa_use_operand_d* prev; 34 struct ssa_use_operand_d* next; 35 tree stmt; 36 tree * use; 37 } 38 ssa_use_operand_t; 39 struct tree_ssa_name { 40 struct ssa_use_operand_d imm_uses; 41 }; 42 union tree_node { 43 struct tree_common common; 44 struct tree_string string; 45 struct tree_list list; 46 struct tree_exp exp; 47 struct tree_ssa_name ssa_name; 48 }; 49 typedef struct bitmap_head_def *bitmap; 50 typedef union varray_data_tag { 51 char c[1]; 52 int i[1]; 53 tree * tp[1]; 54 } 55 varray_data; 56 struct varray_head_tag { 57 size_t num_elements; 58 size_t elements_used; 59 varray_data data; 60 }; 61 typedef struct varray_head_tag *varray_type; 62 extern void varray_check_failed (varray_type, size_t, const char *, int, const char *) __attribute__ ((__noreturn__)); 63 typedef ssa_use_operand_t *use_operand_p; 64 struct use_optype_d { 65 struct use_optype_d *next; 66 struct ssa_use_operand_d use_ptr; 67 }; 68 typedef struct use_optype_d *use_optype_p; 69 struct ssa_operand_memory_d { 70 char mem[(2048 - sizeof (void *))]; 71 }; 72 struct stmt_operands_d { 73 struct use_optype_d * use_ops; 74 }; 75 struct ptr_info_def { 76 tree name_mem_tag; 77 }; 78 typedef struct subvar *subvar_t; 79 struct var_ann_d { 80 size_t uid; 81 }; 82 struct stmt_ann_d { 83 unsigned modified : 1; 84 struct stmt_operands_d operands; 85 bitmap addresses_taken; 86 }; 87 typedef struct var_ann_d *var_ann_t; 88 typedef struct stmt_ann_d *stmt_ann_t; var_ann(tree t)89 static __inline__ var_ann_t var_ann (tree t) { 90 } stmt_ann(tree t)91 static __inline__ stmt_ann_t stmt_ann (tree t) { 92 ((void)(!(is_gimple_stmt (t)) ? fancy_abort ("/home/cygnus/dnovillo/gcc/src.ppc64/gcc/tree-flow-inline.h", 55, __FUNCTION__), 0 : 0)); 93 return (stmt_ann_t) t->common.ann; 94 } stmt_modified_p(tree t)95 static __inline__ unsigned char stmt_modified_p (tree t) { 96 stmt_ann_t ann = stmt_ann (t); 97 return ann ? ann->modified : 1; 98 } delink_imm_use(ssa_use_operand_t * linknode)99 static __inline__ void delink_imm_use (ssa_use_operand_t *linknode) { 100 if (linknode->prev == ((void *)0)) return; 101 linknode->prev->next = linknode->next; 102 linknode->next->prev = linknode->prev; 103 linknode->prev = ((void *)0); 104 linknode->next = ((void *)0); 105 } link_imm_use_to_list(ssa_use_operand_t * linknode,ssa_use_operand_t * list)106 static __inline__ void link_imm_use_to_list (ssa_use_operand_t *linknode, ssa_use_operand_t *list) { 107 linknode->prev = list; 108 linknode->next = list->next; 109 list->next = linknode; 110 } link_imm_use(ssa_use_operand_t * linknode,tree def)111 static __inline__ void link_imm_use (ssa_use_operand_t *linknode, tree def) { 112 ssa_use_operand_t *root; 113 if (!def || ((enum tree_code) (def)->common.code) != SSA_NAME) linknode->prev = ((void *)0); 114 else { 115 root = &(__extension__ ({ const tree __t = (def); if (((enum tree_code) (__t)->common.code) != (SSA_NAME)) tree_check_failed (__t, "/home/cygnus/dnovillo/gcc/src.ppc64/gcc/tree-flow-inline.h", 222, __FUNCTION__, (SSA_NAME), 0); __t; } 116 )->ssa_name.imm_uses); 117 link_imm_use_to_list (linknode, root); 118 } 119 } link_imm_use_stmt(ssa_use_operand_t * linknode,tree def,tree stmt)120 static __inline__ void link_imm_use_stmt (ssa_use_operand_t *linknode, tree def, tree stmt) { 121 link_imm_use (linknode, def); 122 } 123 struct ggc_root_tab { 124 }; 125 struct opbuild_list_d { 126 varray_type vars; 127 varray_type uid; 128 varray_type next; 129 int first; 130 unsigned num; 131 }; 132 static struct opbuild_list_d build_uses; 133 static struct opbuild_list_d build_v_may_defs; 134 static struct ssa_operand_memory_d *operand_memory = ((void *)0); 135 static unsigned operand_memory_index; 136 static use_optype_p free_uses = ((void *)0); opbuild_next(struct opbuild_list_d * list,int prev)137 static __inline__ int opbuild_next (struct opbuild_list_d *list, int prev) { 138 return __extension__ (*({ 139 varray_type const _va = (list->next); 140 const size_t _n = (prev); 141 if (_n >= _va->num_elements) varray_check_failed (_va, _n, "/home/cygnus/dnovillo/gcc/src.ppc64/gcc/tree-ssa-operands.c", 323, __FUNCTION__); 142 &_va->data.i[_n]; 143 } 144 )); 145 } opbuild_elem_real(struct opbuild_list_d * list,int elem)146 static __inline__ tree * opbuild_elem_real (struct opbuild_list_d *list, int elem) { 147 return __extension__ (*({ 148 varray_type const _va = (list->vars); 149 const size_t _n = (elem); 150 if (_n >= _va->num_elements) varray_check_failed (_va, _n, "/home/cygnus/dnovillo/gcc/src.ppc64/gcc/tree-ssa-operands.c", 332, __FUNCTION__); 151 &_va->data.tp[_n]; 152 } 153 )); 154 } opbuild_clear(struct opbuild_list_d * list)155 static __inline__ void opbuild_clear (struct opbuild_list_d *list) { 156 ((list->vars)->elements_used = 0); 157 ((list->next)->elements_used = 0); 158 } ssa_operand_alloc(unsigned size)159 static __inline__ void * ssa_operand_alloc (unsigned size) { 160 char *ptr; 161 if (operand_memory_index + size >= (2048 - sizeof (void *))) { 162 ptr = ggc_alloc_stat (sizeof (struct ssa_operand_memory_d) ); 163 } 164 ptr = &(operand_memory->mem[operand_memory_index]); 165 return ptr; 166 } correct_use_link(use_operand_p ptr,tree stmt)167 static __inline__ void correct_use_link (use_operand_p ptr, tree stmt) { 168 use_operand_p prev; 169 tree root; 170 prev = ptr->prev; 171 if (prev) { 172 unsigned char stmt_mod = 1; 173 while (stmt_mod) { while (prev->stmt == stmt || prev->stmt == ((void *)0)) prev = prev->prev; if (prev->use == ((void *)0)) stmt_mod = 0; else if ((stmt_mod = stmt_modified_p (prev->stmt))) prev = prev->prev; } 174 if (prev->use == ((void *)0)) root = prev->stmt; 175 else root = *(prev->use); 176 if (root == *(ptr->use)) return; 177 } 178 delink_imm_use (ptr); 179 link_imm_use (ptr, *(ptr->use)); 180 } alloc_use(void)181 static __inline__ struct use_optype_d * alloc_use (void) { 182 struct use_optype_d *ret; 183 { 184 free_uses = free_uses->next; 185 } 186 ret = (struct use_optype_d *)ssa_operand_alloc (sizeof (struct use_optype_d)); 187 return ret; 188 } finalize_ssa_use_ops(tree stmt)189 static __inline__ void finalize_ssa_use_ops (tree stmt) { 190 int new_i; 191 struct use_optype_d *old_ops, *ptr, *last; 192 tree * old_base; 193 struct use_optype_d new_list; 194 last = &new_list; 195 if (old_ops) old_base = ((old_ops)->use_ptr.use); 196 while (old_ops && new_i != -1) { 197 tree * new_base = opbuild_elem_real (&build_uses, (new_i)); 198 if (old_base == new_base) { last->next = old_ops; last = old_ops; correct_use_link ((&((last)->use_ptr)), stmt); old_ops = old_ops->next; new_i = opbuild_next (&build_uses, new_i); } 199 else if (old_base < new_base) { use_operand_p use_p = (&((old_ops)->use_ptr)); delink_imm_use (use_p); old_ops = old_ops->next; ptr->next = free_uses; } 200 else { ptr = alloc_use (); (ptr)->use_ptr.use = (opbuild_elem_real (&build_uses, (new_i))); link_imm_use_stmt (&((ptr)->use_ptr), *(opbuild_elem_real (&build_uses, (new_i))), (stmt)); new_i = opbuild_next (&build_uses, new_i); } 201 if (old_ops) old_base = ((old_ops)->use_ptr.use); 202 } 203 for ( ; 204 new_i != -1; 205 new_i = opbuild_next (&build_uses, new_i)) { 206 ptr = alloc_use (); 207 (ptr)->use_ptr.use = (opbuild_elem_real (&build_uses, (new_i))); 208 link_imm_use_stmt (&((ptr)->use_ptr), *(opbuild_elem_real (&build_uses, (new_i))), (stmt)); 209 } 210 { 211 { use_operand_p use_p = (&((ptr)->use_ptr)); delink_imm_use (use_p); } 212 } 213 (stmt_ann (stmt)->operands.use_ops) = new_list.next; 214 { 215 unsigned x = 0; 216 for (ptr = (stmt_ann (stmt)->operands.use_ops); 217 ptr; 218 ptr = ptr->next) x++; 219 } 220 } finalize_ssa_uses(tree stmt)221 finalize_ssa_uses (tree stmt) { 222 { 223 unsigned x; 224 ((void)(!(*(opbuild_elem_real (&build_uses, x)) != stmt) ? fancy_abort ("/home/cygnus/dnovillo/gcc/src.ppc64/gcc/tree-ssa-operands.c", 581, __FUNCTION__), 0 : 0)); 225 } 226 finalize_ssa_use_ops (stmt); 227 opbuild_clear (&build_uses); 228 } finalize_ssa_v_may_def_ops(tree stmt)229 finalize_ssa_v_may_def_ops (tree stmt) { 230 int new_i; 231 { 232 } 233 for ( ; 234 new_i != -1; 235 new_i = opbuild_next (&build_v_may_defs, new_i)) { 236 } 237 { 238 } 239 } get_expr_operands(tree stmt,tree * expr_p,int flags)240 get_expr_operands (tree stmt, tree *expr_p, int flags) { 241 enum tree_code code; 242 tree expr = *expr_p; 243 { 244 { subvar_t svars; if (var_can_have_subvars (expr) && (svars = get_subvars_for_var (expr))) { } { } } 245 { { if (code == LT_EXPR || code == GE_EXPR) { swap_tree_operands (stmt, &__extension__ (*({const tree __t = __extension__ ({ const tree __t = (expr); char const __c = tree_code_type[(int) (((enum tree_code) (__t)->common.code))]; if (!((__c) >= tcc_reference && (__c) <= tcc_expression)) tree_class_check_failed (__t, tcc_expression, "/home/cygnus/dnovillo/gcc/src.ppc64/gcc/tree-ssa-operands.c", 1435, __FUNCTION__); __t; }); const int __i = (0); if (__i < 0 || __i >= tree_code_length[(int) (((enum tree_code) (__t)->common.code))]) tree_operand_check_failed (__i, ((enum tree_code) (__t)->common.code), "/home/cygnus/dnovillo/gcc/src.ppc64/gcc/tree-ssa-operands.c", 1435, __FUNCTION__); &__t->exp.operands[__i]; })), &__extension__ (*({const tree __t = __extension__ ({ const tree __t = (expr); char const __c = tree_code_type[(int) (((enum tree_code) (__t)->common.code))]; if (!((__c) >= tcc_reference && (__c) <= tcc_expression)) tree_class_check_failed (__t, tcc_expression, "/home/cygnus/dnovillo/gcc/src.ppc64/gcc/tree-ssa-operands.c", 1436, __FUNCTION__); __t; }); const int __i = (1); if (__i < 0 || __i >= tree_code_length[(int) (((enum tree_code) (__t)->common.code))]) tree_operand_check_failed (__i, ((enum tree_code) (__t)->common.code), "/home/cygnus/dnovillo/gcc/src.ppc64/gcc/tree-ssa-operands.c", 1436, __FUNCTION__); &__t->exp.operands[__i]; }))); } { } } } 246 } 247 } get_asm_expr_operands(tree stmt)248 get_asm_expr_operands (tree stmt) { 249 int noutputs = list_length (__extension__ (*({ 250 const tree __t = __extension__ ({ const tree __t = (__extension__ ({ const tree __t = (stmt); if (((enum tree_code) (__t)->common.code) != (ASM_EXPR)) tree_check_failed (__t, "/home/cygnus/dnovillo/gcc/src.ppc64/gcc/tree-ssa-operands.c", 1495, __FUNCTION__, (ASM_EXPR), 0); __t; })); char const __c = tree_code_type[(int) (((enum tree_code) (__t)->common.code))]; if (!((__c) >= tcc_reference && (__c) <= tcc_expression)) tree_class_check_failed (__t, tcc_expression, "/home/cygnus/dnovillo/gcc/src.ppc64/gcc/tree-ssa-operands.c", 1495, __FUNCTION__); __t; } 251 ); 252 const int __i = (1); 253 if (__i < 0 || __i >= tree_code_length[(int) (((enum tree_code) (__t)->common.code))]) tree_operand_check_failed (__i, ((enum tree_code) (__t)->common.code), "/home/cygnus/dnovillo/gcc/src.ppc64/gcc/tree-ssa-operands.c", 1495, __FUNCTION__); 254 &__t->exp.operands[__i]; 255 } 256 ))); 257 const char **oconstraints = (const char **) __builtin_alloca((noutputs) * sizeof (const char *)); 258 int i; 259 tree link; 260 const char *constraint; 261 unsigned char allows_mem, allows_reg, is_inout; 262 { 263 oconstraints[i] = constraint = ((const char *)(__extension__ ({ const tree __t = ((__extension__ ({ const tree __t = ((__extension__ ({ const tree __t = (link); if (((enum tree_code) (__t)->common.code) != (TREE_LIST)) tree_check_failed (__t, "/home/cygnus/dnovillo/gcc/src.ppc64/gcc/tree-ssa-operands.c", 1506, __FUNCTION__, (TREE_LIST), 0); __t; })->list.purpose)); if (((enum tree_code) (__t)->common.code) != (TREE_LIST)) tree_check_failed (__t, "/home/cygnus/dnovillo/gcc/src.ppc64/gcc/tree-ssa-operands.c", 1506, __FUNCTION__, (TREE_LIST), 0); __t; })->list.value)); if (((enum tree_code) (__t)->common.code) != (STRING_CST)) tree_check_failed (__t, "/home/cygnus/dnovillo/gcc/src.ppc64/gcc/tree-ssa-operands.c", 1506, __FUNCTION__, (STRING_CST), 0); __t; } 264 )->string.str)); 265 parse_output_constraint (&constraint, i, 0, 0, &allows_mem, &allows_reg, &is_inout); 266 } 267 } get_indirect_ref_operands(tree stmt,tree expr,int flags)268 get_indirect_ref_operands (tree stmt, tree expr, int flags) { 269 tree *pptr = &__extension__ (*({ 270 const tree __t = __extension__ ({ const tree __t = (expr); char const __c = tree_code_type[(int) (((enum tree_code) (__t)->common.code))]; if (!((__c) >= tcc_reference && (__c) <= tcc_expression)) tree_class_check_failed (__t, tcc_expression, "/home/cygnus/dnovillo/gcc/src.ppc64/gcc/tree-ssa-operands.c", 1591, __FUNCTION__); __t; } 271 ); 272 const int __i = (0); 273 if (__i < 0 || __i >= tree_code_length[(int) (((enum tree_code) (__t)->common.code))]) tree_operand_check_failed (__i, ((enum tree_code) (__t)->common.code), "/home/cygnus/dnovillo/gcc/src.ppc64/gcc/tree-ssa-operands.c", 1591, __FUNCTION__); 274 &__t->exp.operands[__i]; 275 } 276 )); 277 tree ptr = *pptr; 278 { 279 struct ptr_info_def *pi = ((void *)0); 280 if (((enum tree_code) (ptr)->common.code) == SSA_NAME && pi->name_mem_tag) { } 281 } 282 } note_addressable(tree var,stmt_ann_t s_ann)283 note_addressable (tree var, stmt_ann_t s_ann) { 284 subvar_t svars; 285 { 286 if (var_can_have_subvars (var) && (svars = get_subvars_for_var (var))) bitmap_set_bit (s_ann->addresses_taken, var_ann (var)->uid); 287 } 288 } 289 const struct ggc_root_tab gt_ggc_r_gt_tree_ssa_operands_h[] = { 290 { 291 &operand_memory, } 292 , { 293 } 294 , { 295 } 296 , { 297 } 298 , }; 299