]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Issue an error for ms_abi attribute with x32
authorH.J. Lu <hongjiu.lu@intel.com>
Sat, 27 Dec 2014 16:35:41 +0000 (16:35 +0000)
committerH.J. Lu <hjl@gcc.gnu.org>
Sat, 27 Dec 2014 16:35:41 +0000 (08:35 -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: r219083

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr64409.c [new file with mode: 0644]

index 31cafd547818dc1cfd9a2b4d85a855f9cdcd890b..484f0c9979cae6a4b8e85cf5ee5e64d33adba4ea 100644 (file)
@@ -1,3 +1,12 @@
+2014-12-27  H.J. Lu  <hongjiu.lu@intel.com>
+
+       Backport from mainline:
+       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-19  H.J. Lu  <hongjiu.lu@intel.com>
 
        Backported from mainline
index 9b24efce9c2f4b368e6cfd66db3948f45888d47a..6872189a9efe33ba7f15bd899152580de54fee46 100644 (file)
@@ -5539,7 +5539,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 60b2df80c69483fadd3d615ef334113bf47521d9..c3d8e7721b6f0be233856be40d7569c29ba3d743 100644 (file)
@@ -1,3 +1,11 @@
+2014-12-27  H.J. Lu  <hongjiu.lu@intel.com>
+
+       Backport from mainline:
+       2014-12-26  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR target/64409
+       * gcc.target/i386/pr64409.c: New test.
+
 2014-12-23  Janus Weil  <janus@gcc.gnu.org>
 
        Backport from mainline
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" } */