+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
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;
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.
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. */
--- /dev/null
+// 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);
+}