summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4>2016-02-03 20:17:24 +0000
committerH.J. Lu <hjl.tools@gmail.com>2016-04-16 07:47:39 -0700
commitdf45d75fb13279069c6ad45bbea6b9119caa6d4a (patch)
tree5c96e4a72a41a9cef6e1fb95f88a0dc887e5e8e3
parent7a1860c1c82ac4124f3db831c5b2037995fecce7 (diff)
downloadgcc-df45d75fb13279069c6ad45bbea6b9119caa6d4a.tar.gz
Add IA MCU tests for passing/returning of empty structures/unions
* gcc.target/i386/iamcu/test_empty_structs_and_unions.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@233109 138bc75d-0d04-0410-961f-82ee72b054a4 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@233090 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/testsuite/gcc.target/i386/iamcu/test_empty_structs_and_unions.c61
1 files changed, 61 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/i386/iamcu/test_empty_structs_and_unions.c b/gcc/testsuite/gcc.target/i386/iamcu/test_empty_structs_and_unions.c
new file mode 100644
index 00000000000..15209e0111e
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/iamcu/test_empty_structs_and_unions.c
@@ -0,0 +1,61 @@
+/* This tests passing and returning of empty structures and unions. */
+
+#include "defines.h"
+#include "args.h"
+
+struct IntegerRegisters iregbits = { ~0, ~0, ~0, ~0, ~0, ~0 };
+struct IntegerRegisters iregs;
+unsigned int num_iregs;
+
+struct empty_struct
+{
+};
+
+struct empty_struct
+check_struct_passing(struct empty_struct s0 ATTRIBUTE_UNUSED,
+ struct empty_struct s1 ATTRIBUTE_UNUSED,
+ int i0 ATTRIBUTE_UNUSED)
+{
+ struct empty_struct s;
+ check_int_arguments;
+ return s;
+}
+
+#define check_struct_passing WRAP_CALL(check_struct_passing)
+
+union empty_union
+{
+};
+
+union empty_union
+check_union_passing(union empty_union u0 ATTRIBUTE_UNUSED,
+ union empty_union u1 ATTRIBUTE_UNUSED,
+ int i0 ATTRIBUTE_UNUSED)
+{
+ union empty_union u;
+ check_int_arguments;
+ return u;
+}
+
+#define check_union_passing WRAP_CALL(check_union_passing)
+
+int
+main (void)
+{
+ struct empty_struct s;
+ union empty_union u;
+
+ clear_struct_registers;
+ iregs.I0 = 32;
+ num_iregs = 1;
+ clear_int_hardware_registers;
+ check_union_passing(u,u,32);
+
+ clear_struct_registers;
+ iregs.I0 = 33;
+ num_iregs = 1;
+ clear_int_hardware_registers;
+ check_struct_passing(s,s,33);
+
+ return 0;
+}