From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 75BB93857C7A; Sat, 20 Feb 2021 23:26:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 75BB93857C7A From: "kal.conley at dectris dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/99185] New: asan initialization-order-fiasco false positive Date: Sat, 20 Feb 2021 23:26:00 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 10.2.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: kal.conley at dectris dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Feb 2021 23:26:00 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99185 Bug ID: 99185 Summary: asan initialization-order-fiasco false positive Product: gcc Version: 10.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: kal.conley at dectris dot com Target Milestone: --- The default constructor does not initialize primitive types. a.cc: =3D=3D=3D=3D=3D struct A { int value; A() =3D default; }; A g; b.cc: =3D=3D=3D=3D=3D struct A { int value; A() =3D default; }; extern A g; int b =3D []() { g.value =3D 1; return 0; }(); int main() { return 0; } $ g++ -fsanitize=3Daddress -std=3Dc++20 a.cc b.cc; ./a.out =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D3844820=3D=3DERROR: AddressSanitizer: initialization-order-fiasco on = address 0x000000404160 at pc 0x0000004013c6 bp 0x7fff2371ecc0 sp 0x7fff2371ecb0 WRITE of size 4 at 0x000000404160 thread T0 #0 0x4013c5 in b::{lambda()#1}::operator()() const (/home/kal/work/cxx/a.out+0x4013c5) #1 0x4012a8 in __static_initialization_and_destruction_0(int, int) (/home/kal/work/cxx/a.out+0x4012a8) #2 0x40134b in _GLOBAL__sub_I_b (/home/kal/work/cxx/a.out+0x40134b) #3 0x40142c in __libc_csu_init (/home/kal/work/cxx/a.out+0x40142c) #4 0x7f43cfb8b00d in __libc_start_main (/lib64/libc.so.6+0x2700d) #5 0x4010dd in _start (/home/kal/work/cxx/a.out+0x4010dd) 0x000000404160 is located 0 bytes inside of global variable 'g' defined in 'a.cc:5:3' (0x404160) of size 4 registered at: #0 0x7f43d00b5cc8 (/lib64/libasan.so.6+0x37cc8) #1 0x401202 in _sub_I_00099_1 (/home/kal/work/cxx/a.out+0x401202) #2 0x40142c in __libc_csu_init (/home/kal/work/cxx/a.out+0x40142c) SUMMARY: AddressSanitizer: initialization-order-fiasco (/home/kal/work/cxx/a.out+0x4013c5) in b::{lambda()#1}::operator()() const Shadow bytes around the buggy address: 0x0000800787d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0000800787e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0000800787f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x000080078800: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x000080078810: 00 00 00 00 f9 f9 f9 f9 f9 f9 f9 f9 00 00 00 00 =3D>0x000080078820: f9 f9 f9 f9 f9 f9 f9 f9 00 00 00 00[f6]f6 f6 f6 0x000080078830: f6 f6 f6 f6 00 00 00 00 04 f9 f9 f9 f9 f9 f9 f9 0x000080078840: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x000080078850: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x000080078860: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x000080078870: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07=20 Heap left redzone: fa Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb Shadow gap: cc =3D=3D3844820=3D=3DABORTING=