From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6DF863861830; Tue, 30 Mar 2021 13:14:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6DF863861830 From: "marxin at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: =?UTF-8?B?W0J1ZyBsdG8vOTk4MjhdIE5ldzogaW5saW5pbmcgZmFpbGVkIGlu?= =?UTF-8?B?IGNhbGwgdG8g4oCYYWx3YXlzX2lubGluZeKAmSDigJhtZW1jcHnigJk6IC0t?= =?UTF-8?B?cGFyYW0gbWF4LWlubGluZS1pbnNucy1hdXRvIGxpbWl0IHJlYWNoZWQ=?= Date: Tue, 30 Mar 2021 13:14:23 +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: 11.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: marxin 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: Tue, 30 Mar 2021 13:14:23 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99828 Bug ID: 99828 Summary: inlining failed in call to =E2=80=98always_inline=E2=80= =99 =E2=80=98memcpy=E2=80=99: --param max-inline-insns-auto limit reached Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: lto Assignee: unassigned at gcc dot gnu.org Reporter: marxin at gcc dot gnu.org CC: hubicka at gcc dot gnu.org, marxin at gcc dot gnu.org Target Milestone: --- Noticed by Andi Kleen in kernel, reduced to: $ cat 1.i __attribute__((__always_inline__)) void *memcpy(); void *foo =3D memcpy; $ touch 2.s $ cat 3.i int kasan_check_range(); int __memcpy(); enum { false, true } memcpy(void *dest, void *src, long len) { if (kasan_check_range(len, false, 0) || kasan_check_range(len, true, 0)) return __memcpy(dest, src, len); } int *LZ4_decompress_generic_outputSize_op; int mlen; LZ4_decompress_generic_outputSize_match() { { __builtin_memcpy(LZ4_decompress_generic_outputSize_op, LZ4_decompress_generic_outputSize_match, mlen); } } $ gcc 1.i 2.s 3.i -c -flto -Os -shared && gcc [123].o -shared 1.i:1:42: warning: =E2=80=98always_inline=E2=80=99 function might not be in= linable [-Wattributes] 1 | __attribute__((__always_inline__)) void *memcpy(); | ^~~~~~ 3.i:5:1: warning: conflicting types for built-in function =E2=80=98memcpy= =E2=80=99; expected =E2=80=98void *(void *, const void *, long unsigned int)=E2=80=99 [-Wbuiltin-declaration-mismatch] 5 | memcpy(void *dest, void *src, long len) { | ^~~~~~ 3.i:1:1: note: =E2=80=98memcpy=E2=80=99 is declared in header =E2=80=98=E2=80=99 +++ |+#include 1 | int kasan_check_range(); 3.i:13:1: warning: return type defaults to =E2=80=98int=E2=80=99 [-Wimplici= t-int] 13 | LZ4_decompress_generic_outputSize_match() { | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1.i:1:42: warning: type of =E2=80=98memcpy=E2=80=99 does not match original= declaration [-Wlto-type-mismatch] 1 | __attribute__((__always_inline__)) void *memcpy(); | ^ 3.i:5:1: note: return value type mismatch 5 | memcpy(void *dest, void *src, long len) { | ^ : warning: type of =E2=80=98__builtin_memcpy=E2=80=99 does not ma= tch original declaration [-Wlto-type-mismatch] 3.i:5:1: note: return value type mismatch 3.i:5:1: note: =E2=80=98memcpy=E2=80=99 was previously declared here 3.i:5:1: note: code may be misoptimized unless =E2=80=98-fno-strict-aliasin= g=E2=80=99 is used 3.i: In function =E2=80=98LZ4_decompress_generic_outputSize_match=E2=80=99: 1.i:1:42: error: inlining failed in call to =E2=80=98always_inline=E2=80=99= =E2=80=98memcpy=E2=80=99: --param max-inline-insns-auto limit reached 1 | __attribute__((__always_inline__)) void *memcpy(); | ^ 3.i:15:5: note: called from here 15 | __builtin_memcpy(LZ4_decompress_generic_outputSize_op, | ^ lto-wrapper: fatal error: gcc returned 1 exit status compilation terminated. /usr/bin/ld: error: lto-wrapper failed collect2: error: ld returned 1 exit status=