Issue an error for ms_abi attribute with x32
authorH.J. Lu <hongjiu.lu@intel.com>
Sat, 27 Dec 2014 16:14:59 +0000 (16:14 +0000)
committerH.J. Lu <hjl@gcc.gnu.org>
Sat, 27 Dec 2014 16:14:59 +0000 (08:14 -0800)
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
gcc/config/i386/i386.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr64409.c [new file with mode: 0644]

index 432706107efbba72298481a37b083b226ae249f8..ff8a5e640f130d1cf21ca9ad4328ed0a7a0e7146 100644 (file)
@@ -1,3 +1,9 @@
+2014-12-27  H.J. Lu  <hongjiu.lu@intel.com>
+
+       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  <green@moxielogic.com>
 
        * config/moxie/moxie-protos.h (moxie_offset_address_p): Define.
index 122a350d99db656f64abc0d1c4d0d6b54d1b88b6..d693fdb2d336857c1403d0251b714558df7ac5fc 100644 (file)
@@ -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;
index d0bee5d1553a11dbe2e4f2bed56c7929f3bf3c33..3725770050ca3876c1598ac9552955e7e896499c 100644 (file)
@@ -1,3 +1,8 @@
+2014-12-26  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR target/64409
+       * gcc.target/i386/pr64409.c: New test.
+
 2014-12-24  Segher Boessenkool  <segher@kernel.crashing.org>
 
        * 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 (file)
index 0000000..6a64b59
--- /dev/null
@@ -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" } */