volatile struct requires static initialisation with asan in c++11 ?

Jan Smets jan@smets.cx
Thu Sep 29 15:43:00 GMT 2016


I am trying to understand why the following code snippet produces a
call to __static_initialization_and_destruction_0(int, int)

This is only observed when compiling as C++ with -fsanitize=address
and -std=c++11. (but not in c++98)

typedef volatile struct A { int a; } tA;
typedef struct B { tA a; } tB;
tB X;

Compiled with GCC 5.

Thank you

Smets Jan

More information about the Gcc-help mailing list