diff --git a/gcc/calls.cc b/gcc/calls.cc index a4336c1..f4e1299 100644 --- a/gcc/calls.cc +++ b/gcc/calls.cc @@ -2186,10 +2186,11 @@ load_register_parameters (struct arg_data *args, int num_actuals, && immediate_const_ctor_p (DECL_INITIAL (tree_value))) { rtx target = gen_reg_rtx (word_mode); - rtx x = expand_expr (DECL_INITIAL (tree_value), - target, word_mode, EXPAND_NORMAL); + store_constructor (DECL_INITIAL (tree_value), target, 0, + int_expr_size (DECL_INITIAL (tree_value)), + false); reg = gen_rtx_REG (word_mode, REGNO (reg)); - emit_move_insn (reg, x); + emit_move_insn (reg, target); } else if (partial == 0 || args[i].pass_on_stack) { diff --git a/gcc/expr.cc b/gcc/expr.cc index fb062dc..85cb414 100644 --- a/gcc/expr.cc +++ b/gcc/expr.cc @@ -84,7 +84,6 @@ static void emit_block_move_via_loop (rtx, rtx, rtx, unsigned); static void clear_by_pieces (rtx, unsigned HOST_WIDE_INT, unsigned int); static rtx_insn *compress_float_constant (rtx, rtx); static rtx get_subtarget (rtx); -static void store_constructor (tree, rtx, int, poly_int64, bool); static rtx store_field (rtx, poly_int64, poly_int64, poly_uint64, poly_uint64, machine_mode, tree, alias_set_type, bool, bool); @@ -100,7 +99,6 @@ static void do_tablejump (rtx, machine_mode, rtx, rtx, rtx, profile_probability); static rtx const_vector_from_tree (tree); static tree tree_expr_size (const_tree); -static HOST_WIDE_INT int_expr_size (const_tree); static void convert_mode_scalar (rtx, rtx, int); @@ -6757,7 +6755,7 @@ fields_length (const_tree type) which has been packed to exclude padding bits. If REVERSE is true, the store is to be done in reverse order. */ -static void +void store_constructor (tree exp, rtx target, int cleared, poly_int64 size, bool reverse) { @@ -13209,7 +13207,7 @@ expr_size (tree exp) /* Return a wide integer for the size in bytes of the value of EXP, or -1 if the size can vary or is larger than an integer. */ -static HOST_WIDE_INT +HOST_WIDE_INT int_expr_size (const_tree exp) { tree size; diff --git a/gcc/expr.h b/gcc/expr.h index d777c28..0351183 100644 --- a/gcc/expr.h +++ b/gcc/expr.h @@ -339,6 +339,8 @@ extern bool categorize_ctor_elements (const_tree, HOST_WIDE_INT *, HOST_WIDE_INT *, HOST_WIDE_INT *, bool *); extern bool immediate_const_ctor_p (const_tree, unsigned int words = 1); +extern void store_constructor (tree, rtx, int, poly_int64, bool); +extern HOST_WIDE_INT int_expr_size (const_tree exp); extern void expand_operands (tree, tree, rtx, rtx*, rtx*, enum expand_modifier); diff --git a/gcc/testsuite/gcc.dg/pr105853.c b/gcc/testsuite/gcc.dg/pr105853.c new file mode 100644 index 0000000..4f234ac --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr105853.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +struct { + struct { + short e16[3]; + } +} const eth_addr_zero = {{}}; /* { dg-warning "no semicolon at" } */ +void compose_nd_na_ipv6_src() { + packet_set_nd(eth_addr_zero); /* { dg-warning "implicit declaration" } */ +} diff --git a/gcc/testsuite/gcc.dg/pr105856.c b/gcc/testsuite/gcc.dg/pr105856.c new file mode 100644 index 0000000..dd3aa2f --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr105856.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ +#pragma pack(1) +struct { + unsigned f0; +} static g_251 = {6}; +void g_329_3() { + func_19(g_251); /* { dg-warning "implicit declaration" } */ +} +