This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 2/2] Libsanitizer merge from upstream r253555.
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Maxim Ostapenko <m dot ostapenko at partner dot samsung dot com>
- Cc: Kostya Serebryany <kcc at google dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>, Yury Gribov <y dot gribov at samsung dot com>, Vyacheslav Barinov <v dot barinov at samsung dot com>, Slava Garbuzov <v dot garbuzov at samsung dot com>
- Date: Mon, 23 Nov 2015 09:19:18 +0100
- Subject: Re: [PATCH 2/2] Libsanitizer merge from upstream r253555.
- Authentication-results: sourceware.org; auth=none
- References: <5652C3E0 dot 4030000 at partner dot samsung dot com> <5652C4CE dot 7020409 at partner dot samsung dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Mon, Nov 23, 2015 at 10:48:30AM +0300, Maxim Ostapenko wrote:
> Index: gcc/testsuite/c-c++-common/asan/halt_on_error-1.c
> ===================================================================
> --- gcc/testsuite/c-c++-common/asan/halt_on_error-1.c (revision 0)
> +++ gcc/testsuite/c-c++-common/asan/halt_on_error-1.c (working copy)
> @@ -0,0 +1,23 @@
> +/* Test recovery mode. */
> +/* { dg-do run } */
> +/* { dg-options "-fsanitize-recover=address" } */
> +/* { dg-set-target-env-var ASAN_OPTIONS "halt_on_error=false" } */
> +
> +#include <string.h>
> +
> +volatile int ten = 10;
> +
> +int main() {
> + char x[10];
> + memset(x, 0, 11);
Please use ten + 1 instead of 11 here.
With -fsanitize=address, there will be padding immediately after the
variable, therefore otherwise (if the compiler does not see we are
running into undefined behavior) the testcase might be ok.
> --- gcc/testsuite/c-c++-common/asan/halt_on_error-2.c (revision 0)
> +++ gcc/testsuite/c-c++-common/asan/halt_on_error-2.c (working copy)
> @@ -0,0 +1,24 @@
> +/* Test recovery mode. */
> +/* { dg-do run } */
> +/* { dg-options "-fsanitize-recover=address" } */
> +/* { dg-set-target-env-var ASAN_OPTIONS "halt_on_error=true" } */
> +/* { dg-shouldfail "asan" } */
> +
> +#include <string.h>
> +
> +volatile int ten = 10;
> +
> +int main() {
> + char x[10];
> + memset(x, 0, 11);
Likewise.
Otherwise OK for trunk.
Jakub