From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7927B3858CDA; Mon, 26 Sep 2022 01:53:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7927B3858CDA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1664157235; bh=IW45PGauW0w/zW+tuY2zItfQekTLs/lacKZAeboNpV8=; h=From:To:Subject:Date:From; b=BmSv0EUAvqm3sBPDmMsXFEdaugG2wQ0WrE60sJJcBuyXxhiCY36QPIPKH2B3bMUWT 09ioXUIGBP/C+OFtwA9vUV0IUQBLxo7+AFHBnJYLKXbur5EpBtsT/oiQGumegXZhX0 w4AlhcI5wkcqhuJkD2HBoD40kmWb16jkEKf6lT4w= From: "tlwang at uwaterloo dot ca" To: gcc-bugs@gcc.gnu.org Subject: [Bug lto/107036] New: Emitted binary code changes when -g is enabled at -O1 -flto and optimize attribute Date: Mon, 26 Sep 2022 01:53:52 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: lto X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: tlwang at uwaterloo dot ca 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 cc 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107036 Bug ID: 107036 Summary: Emitted binary code changes when -g is enabled at -O1 -flto and optimize attribute Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: lto Assignee: unassigned at gcc dot gnu.org Reporter: tlwang at uwaterloo dot ca CC: marxin at gcc dot gnu.org Target Milestone: --- This occurs when compiling attributes_program0_preprocessed.c as shown belo= w: $ cat attributes_program0_preprocessed.c struct { volatile short a; int b; } c =3D {1}; void d() { short e =3D c.b; } void f() {} void g() { c.a; } __attribute__((optimize(0))) int main() { f(g); d(); } $ gcc-trunk -v Using built-in specs. COLLECT_GCC=3Dgcc-trunk COLLECT_LTO_WRAPPER=3D/scratch/software/gcc-trunk/libexec/gcc/x86_64-pc-lin= ux-gnu/13.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /tmp/tmp.KbBz3lKFoo-gcc-builder/gcc/configure --enable-languages=3Dc,c++,lto --enable-checking-yes --enable-multiarch --prefix=3D/scratch/software/gcc-trunk --disable-bootstrap Thread model: posix Supported LTO compression algorithms: zlib gcc version 13.0.0 20220925 (experimental) [master -g28a61ecdc] (GCC) tlwang@cartesian:~/inline_asm_bugs/3966721184$ gcc-trunk -w -flto -O1 attributes_program0_preprocessed.c -o a.out ; objdump --disassemble --section=3D.text a.out > no_dbg.txt $ gcc-trunk -w -flto -O1 attributes_program0_preprocessed.c -g -o a.out ; objdump --disassemble --section=3D.text a.out > dbg.txt $ diff no_dbg.txt dbg.txt 98,100c98,101 < 401113: 0f b7 05 ee 0e 00 00 movzwl 0xeee(%rip),%eax # 40= 2008 < 40111a: c3 retq < 40111b: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1) --- > 401113: c3 retq > 401114: 66 2e 0f 1f 84 00 00 nopw %cs:0x0(%rax,%rax,1) > 40111b: 00 00 00 > 40111e: 66 90 xchg %ax,%ax=