aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJames Clarke <jrtc27@jrtc27.com>2016-10-06 10:28:23 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2016-10-06 10:28:23 +0000
commit139dc3c65114ff2497a0391ca7698992eb57f6cd (patch)
treea74084b26c37d69e5ce67c00721195990ec7db5b /gcc
parent37f6a157f592dcd13f61f693b40257621ac83226 (diff)
downloadgcc-139dc3c65114ff2497a0391ca7698992eb57f6cd.zip
gcc-139dc3c65114ff2497a0391ca7698992eb57f6cd.tar.gz
gcc-139dc3c65114ff2497a0391ca7698992eb57f6cd.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/config/sparc/sparc.c33
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/other/pr77759.C21
4 files changed, 50 insertions, 17 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b7e7a6d..5fd5c7a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+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
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index c622b66..c1c196b 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -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. */
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 0f24a75..0858846 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+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
diff --git a/gcc/testsuite/g++.dg/other/pr77759.C b/gcc/testsuite/g++.dg/other/pr77759.C
new file mode 100644
index 0000000..71bee65
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/pr77759.C
@@ -0,0 +1,21 @@
+// 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);
+}