aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@gcc.gnu.org>2004-01-22 09:15:50 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2004-01-22 09:15:50 +0000
commitb2f24c85c8b21cd649d11da2eb8c65079d3f21b7 (patch)
treebd260cebbcf684b9d5f1649ae257ae65d7c6ff47 /gcc
parentb4e0dd8eb74ae9911b0fcb274c77a294a2961cf8 (diff)
downloadgcc-b2f24c85c8b21cd649d11da2eb8c65079d3f21b7.zip
gcc-b2f24c85c8b21cd649d11da2eb8c65079d3f21b7.tar.gz
gcc-b2f24c85c8b21cd649d11da2eb8c65079d3f21b7.tar.bz2
sparc.c (function_arg_record_value_1): Fix computation of the number of integer registers required.
* config/sparc/sparc.c (function_arg_record_value_1): Fix computation of the number of integer registers required. From-SVN: r76339
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/config/sparc/sparc.c7
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.dg/struct-by-value-2.c15
4 files changed, 29 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 80af02b..5c01e68 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2004-01-22 Olivier Hainque <hainque@act-europe.fr>
+
+ * config/sparc/sparc.c (function_arg_record_value_1): Fix
+ computation of the number of integer registers required.
+
2004-01-21 Kazu Hirata <kazu@cs.umass.edu>
* config/i386/i386.md: Simplify certain comparisons of
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index 6002a5d..d3eb998 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -5039,10 +5039,13 @@ function_arg_record_value_1 (tree type, HOST_WIDE_INT startbitpos,
{
if (parms->intoffset != -1)
{
+ unsigned int startbit, endbit;
int intslots, this_slotno;
- intslots = (bitpos - parms->intoffset + BITS_PER_WORD - 1)
- / BITS_PER_WORD;
+ startbit = parms->intoffset & -BITS_PER_WORD;
+ endbit = (bitpos + BITS_PER_WORD - 1) & -BITS_PER_WORD;
+
+ intslots = (endbit - startbit) / BITS_PER_WORD;
this_slotno = parms->slotno + parms->intoffset
/ BITS_PER_WORD;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 433533f..9d8d1fb 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2004-01-22 Eric Botcazou <ebotcazou@libertysurf.fr>
+
+ * gcc.dg/struct-by-value-2.c: New test.
+
2004-01-21 Andrew Pinski <apinski@apple.com>
PR target/13785
diff --git a/gcc/testsuite/gcc.dg/struct-by-value-2.c b/gcc/testsuite/gcc.dg/struct-by-value-2.c
new file mode 100644
index 0000000..8d5d0bb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/struct-by-value-2.c
@@ -0,0 +1,15 @@
+/* This testcase caused a sanity check to abort on SPARC64
+ because of a discrepancy between two functions involved
+ in the calculation of structure layout. */
+
+/* { dg-do compile } */
+
+struct S { float f1; int i1; int i2; float f2; };
+
+extern void foo(struct S);
+
+void bar(void)
+{
+ struct S s;
+ foo(s);
+}