There is no counter part of x32 in MS ABI. Issue an error when ms_abi
attribute is used with x32. OK for trunk and branches?
Thanks.
H.J.
---
gcc/
PR target/64409
* config/i386/i386.c (ix86_function_type_abi): Issue an error
when ms_abi attribute is used with x32.
gcc/testsuite/
PR target/64409
* gcc.target/i386/pr64409.c: New test.
---
gcc/ChangeLog | 6 ++++++
gcc/config/i386/i386.c | 13 ++++++++++++-
gcc/testsuite/ChangeLog | 5 +++++
gcc/testsuite/gcc.target/i386/pr64409.c | 6 ++++++
4 files changed, 29 insertions(+), 1 deletion(-)
create mode 100644 gcc/testsuite/gcc.target/i386/pr64409.c
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 2d21dfe..fbb92bd 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2014-12-26 H.J. Lu <[email protected]>
+
+ PR target/64409
+ * config/i386/i386.c (ix86_function_type_abi): Issue an error
+ when ms_abi attribute is used with x32.
+
2014-12-24 Oleg Endo <[email protected]>
PR target/51244
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 122a350..d693fdb 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -6116,7 +6116,18 @@ ix86_function_type_abi (const_tree fntype)
if (abi == SYSV_ABI)
{
if (lookup_attribute ("ms_abi", TYPE_ATTRIBUTES (fntype)))
- abi = MS_ABI;
+ {
+ if (TARGET_X32)
+ {
+ static bool warned = false;
+ if (!warned)
+ {
+ error ("X32 does not support ms_abi attribute");
+ warned = true;
+ }
+ }
+ abi = MS_ABI;
+ }
}
else if (lookup_attribute ("sysv_abi", TYPE_ATTRIBUTES (fntype)))
abi = SYSV_ABI;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index d0bee5d..3725770 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2014-12-26 H.J. Lu <[email protected]>
+
+ PR target/64409
+ * gcc.target/i386/pr64409.c: New test.
+
2014-12-24 Segher Boessenkool <[email protected]>
* gcc.target/powerpc/405-dlmzb-strlen-1.c: Explicitly align arg.
diff --git a/gcc/testsuite/gcc.target/i386/pr64409.c
b/gcc/testsuite/gcc.target/i386/pr64409.c
new file mode 100644
index 0000000..6a64b59
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr64409.c
@@ -0,0 +1,6 @@
+/* { dg-do compile { target { ! { ia32 } } } } */
+/* { dg-require-effective-target maybe_x32 } */
+/* { dg-options "-O0 -mx32" } */
+
+int a;
+int* __attribute__ ((ms_abi)) fn1 () { return &a; } /* { dg-error "X32 does
not support ms_abi attribute" } */
--
1.9.3