Commit 72834792 by Jakub Jelinek Committed by Jakub Jelinek

re PR middle-end/91001 (internal compiler error: in extract_insn, at recog.c:2310)

	PR middle-end/91001
	PR middle-end/91105
	PR middle-end/91106
	* calls.c (load_register_parameters): For TYPE_TRANSPARENT_AGGR
	types, use type of their first field instead of type of
	args[i].tree_value.

	* gcc.c-torture/compile/pr91001.c: New test.

From-SVN: r275408
parent 5a4c9a49
2019-09-05 Jakub Jelinek <jakub@redhat.com>
PR middle-end/91001
PR middle-end/91105
PR middle-end/91106
* calls.c (load_register_parameters): For TYPE_TRANSPARENT_AGGR
types, use type of their first field instead of type of
args[i].tree_value.
2019-09-05 Richard Biener <rguenther@suse.de> 2019-09-05 Richard Biener <rguenther@suse.de>
PR rtl-optimization/91656 PR rtl-optimization/91656
......
...@@ -2771,6 +2771,11 @@ load_register_parameters (struct arg_data *args, int num_actuals, ...@@ -2771,6 +2771,11 @@ load_register_parameters (struct arg_data *args, int num_actuals,
poly_int64 size = 0; poly_int64 size = 0;
HOST_WIDE_INT const_size = 0; HOST_WIDE_INT const_size = 0;
rtx_insn *before_arg = get_last_insn (); rtx_insn *before_arg = get_last_insn ();
tree type = TREE_TYPE (args[i].tree_value);
if ((TREE_CODE (type) == UNION_TYPE
|| TREE_CODE (type) == RECORD_TYPE)
&& TYPE_TRANSPARENT_AGGR (type))
type = TREE_TYPE (first_field (type));
/* Set non-negative if we must move a word at a time, even if /* Set non-negative if we must move a word at a time, even if
just one word (e.g, partial == 4 && mode == DFmode). Set just one word (e.g, partial == 4 && mode == DFmode). Set
to -1 if we just use a normal move insn. This value can be to -1 if we just use a normal move insn. This value can be
...@@ -2783,11 +2788,11 @@ load_register_parameters (struct arg_data *args, int num_actuals, ...@@ -2783,11 +2788,11 @@ load_register_parameters (struct arg_data *args, int num_actuals,
gcc_assert (partial % UNITS_PER_WORD == 0); gcc_assert (partial % UNITS_PER_WORD == 0);
nregs = partial / UNITS_PER_WORD; nregs = partial / UNITS_PER_WORD;
} }
else if (TYPE_MODE (TREE_TYPE (args[i].tree_value)) == BLKmode) else if (TYPE_MODE (type) == BLKmode)
{ {
/* Variable-sized parameters should be described by a /* Variable-sized parameters should be described by a
PARALLEL instead. */ PARALLEL instead. */
const_size = int_size_in_bytes (TREE_TYPE (args[i].tree_value)); const_size = int_size_in_bytes (type);
gcc_assert (const_size >= 0); gcc_assert (const_size >= 0);
nregs = (const_size + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD; nregs = (const_size + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD;
size = const_size; size = const_size;
...@@ -2914,8 +2919,7 @@ load_register_parameters (struct arg_data *args, int num_actuals, ...@@ -2914,8 +2919,7 @@ load_register_parameters (struct arg_data *args, int num_actuals,
if (GET_CODE (reg) == PARALLEL) if (GET_CODE (reg) == PARALLEL)
use_group_regs (call_fusage, reg); use_group_regs (call_fusage, reg);
else if (nregs == -1) else if (nregs == -1)
use_reg_mode (call_fusage, reg, use_reg_mode (call_fusage, reg, TYPE_MODE (type));
TYPE_MODE (TREE_TYPE (args[i].tree_value)));
else if (nregs > 0) else if (nregs > 0)
use_regs (call_fusage, REGNO (reg), nregs); use_regs (call_fusage, REGNO (reg), nregs);
} }
......
2019-09-05 Jakub Jelinek <jakub@redhat.com>
PR middle-end/91001
PR middle-end/91105
PR middle-end/91106
* gcc.c-torture/compile/pr91001.c: New test.
2019-09-05 Richard Biener <rguenther@suse.de> 2019-09-05 Richard Biener <rguenther@suse.de>
PR rtl-optimization/91656 PR rtl-optimization/91656
......
/* PR middle-end/91001 */
/* PR middle-end/91105 */
/* PR middle-end/91106 */
struct __attribute__((packed)) S { short b; char c; };
struct T { short b, c, d; };
struct __attribute__((packed)) R { int b; char c; };
union __attribute__((aligned(128), transparent_union)) U { struct S c; } u;
union __attribute__((aligned(32), transparent_union)) V { struct T c; } v;
union __attribute__((aligned(32), transparent_union)) W { struct R c; } w;
void foo (union U);
void bar (union V);
void baz (union W);
void
qux (void)
{
foo (u);
}
void
quux (void)
{
bar (v);
}
void
corge (void)
{
baz (w);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment