This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

C++ PATCH to warn about vector mangling with -Wabi (more c++/12909)


This patch adds vector mangling to the list of things warned about by -Wabi, which is more useful after the previous patch fixing the false positive with empty classes. It also improves the documentation.

The attached testcase assumes some later patches as well, so I'm not applying it quite yet.

Tested x86_64-pc-linux-gnu, applied to trunk.

commit b8030dff3a8760a3b097ef8f2cf068e7cffc244e
Author: Jason Merrill <jason@redhat.com>
Date:   Tue Feb 23 17:41:40 2010 -0500

    	PR c++/12909
    	* mangle.c (write_type): Give -Wabi warning for old vector mangling.

diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 427b3ad..a3b7e52 100644
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index ca15dab..e6d7934 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -1904,7 +1904,10 @@ write_type (tree type)
 		  write_char ('_');
 		}
 	      else
-		write_string ("U8__vector");
+		{
+		  G.need_abi_warning = 1;
+		  write_string ("U8__vector");
+		}
 	      write_type (TREE_TYPE (type));
 	      break;
 

commit 9bbbc720c5bc74e16c3b752d420dff91b77ffa88
Author: Jason Merrill <jason@redhat.com>
Date:   Wed Feb 24 12:09:26 2010 -0500

    	* doc/invoke.texi: Improve -Wabi and -fabi-version docs.

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5aee0a1..6eb392c 100644
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index f661001..36b3568 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -1780,6 +1780,13 @@ are fixed.
 
 The default is version 2.
 
+Version 3 corrects an error in mangling a constant address as a
+template argument.
+
+Version 4 implements a standard mangling for vector types.
+
+See also @option{-Wabi}.
+
 @item -fno-access-control
 @opindex fno-access-control
 Turn off all access checking.  This switch is mainly useful for working
@@ -2096,7 +2103,30 @@ You should rewrite your code to avoid these warnings if you are
 concerned about the fact that code generated by G++ may not be binary
 compatible with code generated by other compilers.
 
-The known incompatibilities at this point include:
+The known incompatibilities in @option{-fabi-version=2} (the default) include:
+
+@itemize @bullet
+
+@item
+A template with a non-type template parameter of reference type is
+mangled incorrectly:
+@smallexample
+extern int N;
+template <int &> struct S @{@};
+void n (S<N>) @{2@}
+@end smallexample
+
+This is fixed in @option{-fabi-version=3}.
+
+@item
+SIMD vector types declared using @code{__attribute ((vector_size))} are
+mangled in a non-standard way that does not allow for overloading of
+functions taking vectors of different sizes.
+
+The mangling is changed in @option{-fabi-version=4}.
+@end itemize
+
+The known incompatibilities in @option{-fabi-version=1} include:
 
 @itemize @bullet
 

commit 0be69dff1b87e26819b8069dd0c98b2f3cea9ab1
Author: Jason Merrill <jason@redhat.com>
Date:   Wed Feb 24 00:40:03 2010 -0500

    	PR c++/12909
    	* g++.dg/abi/mangle40.C: New.

diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 196c6bf..bbbc3c2 100644
diff --git a/gcc/testsuite/g++.dg/abi/mangle40.C b/gcc/testsuite/g++.dg/abi/mangle40.C
new file mode 100644
index 0000000..c162f86
--- /dev/null
+++ b/gcc/testsuite/g++.dg/abi/mangle40.C
@@ -0,0 +1,10 @@
+// PR c++/41959
+// { dg-do compile { target i?86-*-* x86_64-*-* } }
+// { dg-options "-mavx -Wabi" }
+// { dg-final { scan-assembler "_Z1fDv4_f" } }
+// { dg-final { scan-assembler "_Z1fU8__vectorf" } }
+// { dg-final { scan-assembler "_Z1fDv8_f" } }
+
+#include <x86intrin.h>
+void f(__m128) { }		// { dg-warning "mangled name" }
+void f(__m256) { }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]