Commit 139dc3c6 by James Clarke Committed by Eric Botcazou

re PR target/77759 (ICE in function_arg_record_value on nested empty class)

	PR target/77759
	* config/sparc/sparc.c (classify_data_t): Remove int_regs field.
	(classify_registers): Don't set it
	(function_arg_slotno): Don't initialize and test it.  Tidy up.

Co-Authored-By: Eric Botcazou <ebotcazou@adacore.com>

From-SVN: r240830
parent 37f6a157
2016-10-06 James Clarke <jrtc27@jrtc27.com>
Eric Botcazou <ebotcazou@adacore.com>
PR target/77759
* config/sparc/sparc.c (classify_data_t): Remove int_regs field.
(classify_registers): Don't set it
(function_arg_slotno): Don't initialize and test it. Tidy up.
2016-10-06 Richard Biener <rguenther@suse.de>
PR tree-optimization/77839
......
......@@ -6294,7 +6294,6 @@ traverse_record_type (const_tree type, bool named, T *data,
typedef struct
{
bool int_regs; /* true if field eligible to int registers. */
bool fp_regs; /* true if field eligible to FP registers. */
bool fp_regs_in_first_word; /* true if such field in first word. */
} classify_data_t;
......@@ -6311,8 +6310,6 @@ classify_registers (const_tree, HOST_WIDE_INT bitpos, bool fp,
if (bitpos < BITS_PER_WORD)
data->fp_regs_in_first_word = true;
}
else
data->int_regs = true;
}
/* Compute the slot number to pass an argument in.
......@@ -6439,23 +6436,25 @@ function_arg_slotno (const struct sparc_args *cum, machine_mode mode,
if (TREE_CODE (type) == RECORD_TYPE)
{
classify_data_t data = { false, false, false };
classify_data_t data = { false, false };
traverse_record_type<classify_data_t, classify_registers>
(type, named, &data);
/* If all slots are filled except for the last one, but there
is no FP field in the first word, then must pass on stack. */
if (data.fp_regs
&& !data.fp_regs_in_first_word
&& slotno >= SPARC_FP_ARG_MAX - 1)
return -1;
/* If there are only int args and all int slots are filled,
then must pass on stack. */
if (!data.fp_regs
&& data.int_regs
&& slotno >= SPARC_INT_ARG_MAX)
return -1;
if (data.fp_regs)
{
/* If all FP slots are filled except for the last one and
there is no FP field in the first word, then must pass
on stack. */
if (slotno >= SPARC_FP_ARG_MAX - 1
&& !data.fp_regs_in_first_word)
return -1;
}
else
{
/* If all int slots are filled, then must pass on stack. */
if (slotno >= SPARC_INT_ARG_MAX)
return -1;
}
}
/* PREGNO isn't set since both int and FP regs can be used. */
......
2016-10-06 James Clarke <jrtc27@jrtc27.com>
Eric Botcazou <ebotcazou@adacore.com>
* g++.dg/other/pr77759.C: New test.
2016-10-06 Richard Biener <rguenther@suse.de>
PR tree-optimization/77839
......
// PR target/77759
// This ICEd in the 64-bit SPARC back-end because of the nested empty struct.
// { dg-do compile }
struct empty {};
struct pair_empty
{
struct empty a;
struct empty b;
};
extern void foo (int slot0, int slot1, int slot2, int slot3, int slot4,
int slot5, struct pair_empty pair);
void bar (void)
{
struct pair_empty pair;
foo (0, 0, 0, 0, 0, 0, pair);
}
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