This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[committed] Fix gcc.dg/ubsan/bounds-3.c testcase (PR sanitizer/70875)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 2 Mar 2018 00:30:38 +0100
- Subject: [committed] Fix gcc.dg/ubsan/bounds-3.c testcase (PR sanitizer/70875)
- Authentication-results: sourceware.org; auth=none
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
Eric has reported this testcase fails on sparc64 at -O0.
The reason is that after reporting the upcoming UB it actually performs the
UB, out of bounds write and still expects the test to finish properly, which
sometimes just isn't the case.
Fixed by making the ubsan runtime failure fatal and expecting testsuite
failure instead. Regtested on x86_64-linux and i686-linux, committed to
trunk as obvious.
2018-03-02 Jakub Jelinek <jakub@redhat.com>
PR sanitizer/70875
* gcc.dg/ubsan/bounds-3.c: Add -fno-sanitize-recover=bounds to
dg-options and dg-shouldfail "ubsan" directive.
--- gcc/testsuite/gcc.dg/ubsan/bounds-3.c.jj 2016-05-06 15:09:06.361758948 +0200
+++ gcc/testsuite/gcc.dg/ubsan/bounds-3.c 2018-03-01 17:44:13.722455985 +0100
@@ -1,6 +1,7 @@
/* PR sanitizer/70875 */
/* { dg-do run } */
-/* { dg-options "-fsanitize=bounds" } */
+/* { dg-options "-fsanitize=bounds -fno-sanitize-recover=bounds" } */
+/* { dg-shouldfail "ubsan" } */
int
foo (int n, int k)
Jakub