From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id BC0DC3858D1E; Sun, 25 Sep 2022 04:34:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BC0DC3858D1E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1664080469; bh=HP6jbwJzMexIPnmj3iO5EWFzbMGr60sbkG49uQ51K4w=; h=From:To:Subject:Date:From; b=OCjeMlZpdpG7Ayi1sN0mdqhphw/3aHPxLm+WHpsULfJA+Mcil96CD8oHKOUwBQ0LS wRQfVXLAqefFShXIiFS7aTlRA5sfPp7hpYe7qpNA7k+gMoBpLoL+iOlWja+AFfX3rg CSCc9a4cciL87rUGCj9bB4Xj+7VshAZ2tDdco/f4= From: "tlwang at uwaterloo dot ca" To: gcc-bugs@gcc.gnu.org Subject: [Bug lto/107030] New: Emitted binary code changes when -g is enabled at -O2 -flto and optimize attribute Date: Sun, 25 Sep 2022 04:34:28 +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=3D107030 Bug ID: 107030 Summary: Emitted binary code changes when -g is enabled at -O2 -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: $ 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.O2a2UsOhYi-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 20220924 (experimental) [master -g4afaeaab5] (GCC) $ cat attributes_program0_preprocessed.c int a; union { char b; long c; } d =3D {0}; void e(f) { g(d.b); } __attribute__((optimize(0))) static short h() { e(d.c); int i =3D a; } void g(j) {} int main() {} $ gcc-trunk -w -flto -O2 attributes_program0_preprocessed.c -o a.out; objdu= mp --disassemble --section=3D.text a.out > no_dbg.txt $ gcc-trunk -w -flto -O2 attributes_program0_preprocessed.c -g -o a.out; objdump --disassemble --section=3D.text a.out > dbg.txt $ diff no_dbg.txt dbg.txt 96c96 < 401124: 8b 05 de 0e 00 00 mov 0xede(%rip),%eax # 40= 2008 --- > 401124: 8b 05 da 0e 00 00 mov 0xeda(%rip),%eax # 402004 <= a>=