https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80114
--- Comment #4 from Martin Liška <marxin at gcc dot gnu.org> --- (In reply to Jani Nikula from comment #3) > (In reply to Martin Liška from comment #2) > > Well, just adding the param and -fsanitize-address-use-after-scope does not > > enable any sanitization. One has to add -fsanitize=address to trigger real > > sanitization. With Address Sanitizer, the code really grows, which is kind > > of expected. > > Yes, of course. The full options (in the godbolt link) are: -O2 -std=c11 -x > c -fsanitize=kernel-address -fasan-shadow-offset=0xdfff900000000000 --param > asan-stack=1 --param asan-globals=1 --param > asan-instrumentation-with-call-threshold=10000 > -fsanitize-address-use-after-scope > > I fully expect asan to grow code; I'm just not sure whether such a huge > growth particularly with the combination of --param asan-stack=1 and > -fsanitize-address-use-after-scope is expected. Yep, it's kind of expected overhead coming from -fsanitize-address-use-after-scope. It's caused by fact that the compound literal is going to live as a stack variable. I can imagine better sanitization of ASAN_CHECK builtins when a variable is unpoisoned in a BB and there are array references. How common is such situation and why do you use volatile keyword in combination with a constant index?