From: Richard Biener Date: Thu, 26 Nov 2020 09:07:06 +0000 (+0100) Subject: testsuite/98002 - fix gcc.dg/strncmp-2.c X-Git-Tag: upstream/12.2.0~11523 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5b3a8fad18324cd38c221bdb0ae2b690fc82ede0;p=platform%2Fupstream%2Fgcc.git testsuite/98002 - fix gcc.dg/strncmp-2.c This makes sure not to free() memory we have mprotected to PROT_NONE by calling mprotect again with PROT_READ|PROT_WRITE. This avoids crashing the allocator when in debug mode. 2020-11-16 Richard Biener PR testsuite/98002 * gcc.dg/strncmp-2.c: Call mprotect again before free. --- diff --git a/gcc/testsuite/gcc.dg/strncmp-2.c b/gcc/testsuite/gcc.dg/strncmp-2.c index 6818b30..0d84f93 100644 --- a/gcc/testsuite/gcc.dg/strncmp-2.c +++ b/gcc/testsuite/gcc.dg/strncmp-2.c @@ -40,6 +40,7 @@ static void test_driver_strncmp (void (test_strncmp)(const char *, const char *, e = lib_memcmp(buf1,p2,sz); (*test_memcmp)(buf1,p2,e); } + mprotect (buf2+pgsz,pgsz,PROT_READ|PROT_WRITE); free(buf2); }