From c4575840086f29487a849aed0c680b2dcd51fc1f Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Sat, 27 Dec 2014 16:14:59 +0000 Subject: [PATCH] Issue an error for ms_abi attribute with x32 There is no counter part of x32 in MS ABI. Issue an error when ms_abi attribute is used with x32. 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. From-SVN: r219081 --- 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 432706107ef..ff8a5e640f1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2014-12-27 H.J. Lu + + PR target/64409 + * config/i386/i386.c (ix86_function_type_abi): Issue an error + when ms_abi attribute is used with x32. + 2014-12-27 Anthony Green * config/moxie/moxie-protos.h (moxie_offset_address_p): Define. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 122a350d99d..d693fdb2d33 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 d0bee5d1553..3725770050c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-12-26 H.J. Lu + + PR target/64409 + * gcc.target/i386/pr64409.c: New test. + 2014-12-24 Segher Boessenkool * 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 00000000000..6a64b5961de --- /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" } */ -- 2.30.2