[Bug middle-end/91146] [9/10 Regression] -Werror=array-bounds if compile with -fsanitize=address
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Mar 18 07:41:49 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91146
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |marxin at gcc dot gnu.org
--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The #c9 patch passed bootstrap, but regresses:
FAIL: g++.dg/asan/use-after-scope-types-1.C -O1 execution test
FAIL: g++.dg/asan/use-after-scope-types-1.C -O2 execution test
FAIL: g++.dg/asan/use-after-scope-types-1.C -O3 -g execution test
FAIL: g++.dg/asan/use-after-scope-types-1.C -Os execution test
FAIL: g++.dg/asan/use-after-scope-types-1.C -O2 -flto -fno-use-linker-plugin
-flto-partition=none execution test
FAIL: g++.dg/asan/use-after-scope-types-1.C -O2 -flto -fuse-linker-plugin
-fno-fat-lto-objects execution test
FAIL: g++.dg/asan/use-after-scope-types-2.C -O1 execution test
FAIL: g++.dg/asan/use-after-scope-types-2.C -O2 execution test
FAIL: g++.dg/asan/use-after-scope-types-2.C -O3 -g execution test
FAIL: g++.dg/asan/use-after-scope-types-2.C -Os execution test
FAIL: g++.dg/asan/use-after-scope-types-2.C -O2 -flto -fno-use-linker-plugin
-flto-partition=none execution test
FAIL: g++.dg/asan/use-after-scope-types-2.C -O2 -flto -fuse-linker-plugin
-fno-fat-lto-objects execution test
FAIL: g++.dg/asan/use-after-scope-types-3.C -O1 execution test
FAIL: g++.dg/asan/use-after-scope-types-3.C -O2 execution test
FAIL: g++.dg/asan/use-after-scope-types-3.C -O3 -g execution test
FAIL: g++.dg/asan/use-after-scope-types-3.C -Os execution test
FAIL: g++.dg/asan/use-after-scope-types-3.C -O2 -flto -fno-use-linker-plugin
-flto-partition=none execution test
FAIL: g++.dg/asan/use-after-scope-types-3.C -O2 -flto -fuse-linker-plugin
-fno-fat-lto-objects execution test
FAIL: g++.dg/asan/use-after-scope-types-5.C -O1 execution test
FAIL: g++.dg/asan/use-after-scope-types-5.C -O2 execution test
FAIL: g++.dg/asan/use-after-scope-types-5.C -O3 -g execution test
FAIL: g++.dg/asan/use-after-scope-types-5.C -Os execution test
FAIL: g++.dg/asan/use-after-scope-types-5.C -O2 -flto -fno-use-linker-plugin
-flto-partition=none execution test
FAIL: g++.dg/asan/use-after-scope-types-5.C -O2 -flto -fuse-linker-plugin
-fno-fat-lto-objects execution test
The thing is that those tests do those use after scope accesses but don't
really have anything afterwards that would allow optimizing those accesses
away. With the previous behavior of ASAN_MARK ifns such barriers were in those
ifns.
So, the big question is, what do we want.
For -O0 -fsanitize=address both the unpatched and patched versions work
similarly, and for -O1 -fsanitize=address and higher,
do we want the sanitizer to detect just those after scope uses that would
remain after optimization even in non-instrumented code? Then we want the
patch. Or do we want to detect more after scope uses, even at the expense of
some false positive warnings?
If I try clang++ -O{0,1} -fsanitize=address on the use-after-scope-types-1.C
testcase, then it detects the violation (patched g++ with already -O1
-fsanitize=address doesn't), but clang++ -O{2,3} -fsanitize=address doesn't
detect it (while unpatched g++ -O{2,3} -fsanitize=address does).
More information about the Gcc-bugs
mailing list