[Bug c++/77396] New: address sanitizer crashes if all static global variables are optimized
noone@turm-lahnstein.de
gcc-bugzilla@gcc.gnu.org
Sun Aug 28 12:24:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77396
Bug ID: 77396
Summary: address sanitizer crashes if all static global
variables are optimized
Product: gcc
Version: 6.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: noone@turm-lahnstein.de
Target Milestone: ---
Following stackoverflow discussion:
http://stackoverflow.com/questions/39081183/errors-with-g-5-and-6-when-using-address-sanitizer-and-additional-asan-flags-f/39152524#39152524
Compiling
static int data = 0;
static int dummy = data;
int main() { }
with g++ -O2 -fsanitizer=address and running the executable with
ASAN_OPTIONS=verbosity=0:strict_string_checks=true:detect_odr_violation=2:check_initialization_order=true:detect_stack_use_after_return=true:strict_init_order=true
./a.out
leads since g++5 to an executable for which the sanitizer crashes during the
run.
The problem is that `data` and `dummy` get optimized together with
__asan_register_globals(), but __asan_before_dynamic_init is still called.
More information about the Gcc-bugs
mailing list