diff mbox series

[testsuite] Couple of g++.dg/asan tweaks

Message ID 8251776.uJbodWylbz@polaris
State New
Headers show
Series [testsuite] Couple of g++.dg/asan tweaks | expand

Commit Message

Eric Botcazou Feb. 15, 2019, 11:16 p.m. UTC
One of the tests in g++.dg/asan/asan_oob_test.cc uses unaligned memory 
accesses and g++.dg/asan/function-argument-3.C assumes a specific kind of 
calling conventions for vectors.

Tested on SPARC64/Linux, applied on the mainline.


2019-02-15  Eric Botcazou  <ebotcazou@adacore.com>

	* g++.dg/asan/asan_oob_test.cc: Skip OOB_int on SPARC.
	* g++.dg/asan/function-argument-3.C: Tweak for 32-bit SPARC.
diff mbox series

Patch

Index: g++.dg/asan/asan_oob_test.cc
===================================================================
--- g++.dg/asan/asan_oob_test.cc	(revision 268849)
+++ g++.dg/asan/asan_oob_test.cc	(working copy)
@@ -68,9 +68,13 @@  TEST(AddressSanitizer, OOB_char) {
   OOBTest<U1>();
 }
 
+// The following test uses unaligned memory accesses
+
+#if !defined(__sparc__)
 TEST(AddressSanitizer, OOB_int) {
   OOBTest<U4>();
 }
+#endif
 
 TEST(AddressSanitizer, OOBRightTest) {
   for (size_t access_size = 1; access_size <= 8; access_size *= 2) {
Index: g++.dg/asan/function-argument-3.C
===================================================================
--- g++.dg/asan/function-argument-3.C	(revision 268849)
+++ g++.dg/asan/function-argument-3.C	(working copy)
@@ -2,7 +2,16 @@ 
 // { dg-shouldfail "asan" }
 // { dg-additional-options "-Wno-psabi" }
 
+// On SPARC 32-bit, only vectors up to 8 bytes are passed in registers
+#if defined(__sparc__) && !defined(__sparcv9) && !defined(__arch64__)
+#define SMALL_VECTOR
+#endif
+
+#ifdef SMALL_VECTOR
+typedef int v4si __attribute__ ((vector_size (8)));
+#else
 typedef int v4si __attribute__ ((vector_size (16)));
+#endif
 
 static __attribute__ ((noinline)) int
 goo (v4si *a)
@@ -19,10 +28,14 @@  foo (v4si arg)
 int
 main ()
 {
+#ifdef SMALL_VECTOR
+  v4si v = {1,2};
+#else
   v4si v = {1,2,3,4};
+#endif
   return foo (v);
 }
 
 // { dg-output "ERROR: AddressSanitizer: stack-buffer-overflow on address.*(\n|\r\n|\r)" }
 // { dg-output "READ of size . at.*" }
-// { dg-output ".*'arg' \\(line 14\\) <== Memory access at offset \[0-9\]* overflows this variable.*" }
+// { dg-output ".*'arg' \\(line 23\\) <== Memory access at offset \[0-9\]* overflows this variable.*" }