aboutsummaryrefslogtreecommitdiff
path: root/gcc/config
diff options
context:
space:
mode:
authorRichard Earnshaw <rearnsha@arm.com>1999-10-19 14:27:00 +0000
committerNick Clifton <nickc@gcc.gnu.org>1999-10-19 14:27:00 +0000
commit3a2ea2588f030d5d810f454248616d69f10968d2 (patch)
tree5f7c9d604e6e7d2f76c4dc98f3c9f98b840adb98 /gcc/config
parentdb025289c4d6d4d798c3cc80c118b84ba13b6c76 (diff)
downloadgcc-3a2ea2588f030d5d810f454248616d69f10968d2.zip
gcc-3a2ea2588f030d5d810f454248616d69f10968d2.tar.gz
gcc-3a2ea2588f030d5d810f454248616d69f10968d2.tar.bz2
Fix APCS violation.
From-SVN: r30087
Diffstat (limited to 'gcc/config')
-rw-r--r--gcc/config/arm/arm.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 8509eaa..2e6e969 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -1404,12 +1404,12 @@ arm_return_in_memory (type)
{
tree field;
- /* For a struct the APCS says that we must return in a register if
- every addressable element has an offset of zero. For practical
- purposes this means that the structure can have at most one non
- bit-field element and that this element must be the first one in
- the structure. */
-
+ /* For a struct the APCS says that we only return in a register
+ if the type is 'integer like' and every addressable element
+ has an offset of zero. For practical purposes this means
+ that the structure can have at most one non bit-field element
+ and that this element must be the first one in the structure. */
+
/* Find the first field, ignoring non FIELD_DECL things which will
have been created by C++. */
for (field = TYPE_FIELDS (type);
@@ -1420,7 +1420,19 @@ arm_return_in_memory (type)
if (field == NULL)
return 0; /* An empty structure. Allowed by an extension to ANSI C. */
- /* Now check the remaining fields, if any. */
+ /* Check that the first field is valid for returning in a register... */
+
+ /* ... Floats are not allowed */
+ if (FLOAT_TYPE_P (TREE_TYPE (field)))
+ return 1;
+
+ /* ... Aggregates that are not themselves valid for returning in
+ a register are not allowed. */
+ if (RETURN_IN_MEMORY (TREE_TYPE (field)))
+ return 1;
+
+ /* Now check the remaining fields, if any. Only bitfields are allowed,
+ since they are not addressable. */
for (field = TREE_CHAIN (field);
field;
field = TREE_CHAIN (field))