From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 932FE3854803; Mon, 16 Aug 2021 22:36:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 932FE3854803 From: "dmalcolm at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug ipa/101941] New: Linux kernel build failure due to retaining fnsplit fragment with __attribute__((__error__)) Date: Mon, 16 Aug 2021 22:36:23 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: ipa X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: dmalcolm at gcc dot gnu.org 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 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: Mon, 16 Aug 2021 22:36:23 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D101941 Bug ID: 101941 Summary: Linux kernel build failure due to retaining fnsplit fragment with __attribute__((__error__)) Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: ipa Assignee: unassigned at gcc dot gnu.org Reporter: dmalcolm at gcc dot gnu.org CC: marxin at gcc dot gnu.org Target Milestone: --- I'm attaching a reduced reproducer for an issue seen when attempting to bui= ld a recent linux kernel with gcc trunk (x86_64 gcc 12). With: "-O2 -fconserve-stack", the attached fails with: $ ~/gcc-install/bin/gcc -S -O2 -fconserve-stack aesni-intel_glue.c In function =E2=80=98memset=E2=80=99, inlined from =E2=80=98rfc4106_set_hash_subkey.part.0=E2=80=99 at aesni-= intel_glue.c:58:3: aesni-intel_glue.c:30:5: error: call to =E2=80=98__write_overflow=E2=80=99 = declared with attribute error: detected write beyond size of object passed as 1st parame\ ter 30 | __write_overflow(); | ^~~~~~~~~~~~~~~~~~ Looking at -fdump-tree-all, I see that a "void rfc4106_set_hash_subkey.part= .0 ()" is created in .050t.fnsplit, containing: void rfc4106_set_hash_subkey.part.0 () { int D.2043; struct crypto_aes_ctx ctx; int ret; size_t p_size; u8 * hash_subkey; const u8 * key; unsigned int key_len; int _1; [local count: 1073741824]: [local count: 1073741824]: __write_overflow (); fortify_panic (&__func__); } and is called by rfc4106_set_hash_subkey. However after .104t.phiprop, the call to rfc4106_set_hash_subkey.part.0 is optimized away, but the function fragment is retained, leading to the build failure in "expand", where at .247t.optimized it has: ;; Function rfc4106_set_hash_subkey.part.0 (rfc4106_set_hash_subkey.part.0, funcdef_no=3D3, decl_uid=3D2035, cgraph_uid=3D14, symbol_order=3D14) void rfc4106_set_hash_subkey.part.0 ()=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20 {=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20 [local count: 1073741824]: __write_overflow (); fortify_panic (&__func__);=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20 }=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20 where __write_overflow is marked with __attribute__((__error__)) Reproducer on godbolt.org: https://godbolt.org/z/15oehqjGP Presumably if all calls to a fn "part" are optimized away, that fn part sho= uld also be optimized away.=