Hi! I've noticed that the asan_test.C test started failing today. The problem are many -Wc++1z-compat warnings. This lead to discovery of PR78283, which fixes the "many" part of it, but there are still some, so this patch disables them. While playing with the preprocessed source of the testcase, I've noticed some -Wformat warnings which somebody worked around by using -Wno-format, but that looks wrong - we instead should fix the underlying issue - if the condition for EXPECT_TRUE etc. macros contain % character, then we invoke undefined behavior if there are failures.
Bootstrapped/regtested on x86_64-linux and i686-linux, committed as obvious to trunk. 2016-11-09 Jakub Jelinek <ja...@redhat.com> * g++.dg/asan/asan_test.C: Remove -Wno-format, add -Wno-c++1z-compat. * g++.dg/asan/dejagnu-gtest.h (EXPECT_TRUE): Use "%s" format string in case condition contains % characters. --- gcc/testsuite/g++.dg/asan/asan_test.C.jj 2014-09-25 15:02:37.000000000 +0200 +++ gcc/testsuite/g++.dg/asan/asan_test.C 2016-11-09 21:54:37.038627318 +0100 @@ -2,7 +2,7 @@ // { dg-skip-if "" { *-*-* } { "*" } { "-O2" } } // { dg-skip-if "" { *-*-* } { "-flto" } { "" } } // { dg-additional-sources "asan_globals_test-wrapper.cc" } -// { dg-options "-std=c++11 -fsanitize=address -fno-builtin -Wall -Wno-format -Werror -g -DASAN_UAR=0 -DASAN_HAS_EXCEPTIONS=1 -DASAN_HAS_BLACKLIST=0 -DSANITIZER_USE_DEJAGNU_GTEST=1 -lasan -lpthread -ldl" } +// { dg-options "-std=c++11 -fsanitize=address -fno-builtin -Wall -Wno-c++1z-compat -Werror -g -DASAN_UAR=0 -DASAN_HAS_EXCEPTIONS=1 -DASAN_HAS_BLACKLIST=0 -DSANITIZER_USE_DEJAGNU_GTEST=1 -lasan -lpthread -ldl" } // { dg-additional-options "-DASAN_NEEDS_SEGV=1" { target { ! arm*-*-* } } } // { dg-additional-options "-DASAN_LOW_MEMORY=1 -DASAN_NEEDS_SEGV=0" { target arm*-*-* } } // { dg-additional-options "-DASAN_AVOID_EXPENSIVE_TESTS=1" { target { ! run_expensive_tests } } } --- gcc/testsuite/g++.dg/asan/dejagnu-gtest.h.jj 2014-09-25 15:02:37.255763202 +0200 +++ gcc/testsuite/g++.dg/asan/dejagnu-gtest.h 2016-11-09 21:50:41.352612632 +0100 @@ -68,7 +68,8 @@ while (0) #define EXPECT_TRUE(condition) \ if (!(condition)) \ { \ - fprintf (stderr, "EXPECT_TRUE failed: " #condition "\n"); \ + fprintf (stderr, "%s", \ + "EXPECT_TRUE failed: " #condition "\n"); \ exit (1); \ } #define EXPECT_FALSE(condition) EXPECT_TRUE (!condition) Jakub