public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenther at suse dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug lto/99828] inlining failed in call to ‘always_inline’ ‘memcpy’: --param max-inline-insns-auto limit reached
Date: Wed, 31 Mar 2021 10:05:12 +0000	[thread overview]
Message-ID: <bug-99828-4-82QHwnIlrs@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-99828-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99828

--- Comment #9 from rguenther at suse dot de <rguenther at suse dot de> ---
On Wed, 31 Mar 2021, marxin at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99828
> 
> --- Comment #8 from Martin Liška <marxin at gcc dot gnu.org> ---
> All right, I vanished the test-case:
> 
> $ cat 1.i
> inline __attribute__((__always_inline__)) __attribute__((gnu_inline)) void *
> memcpy();
> void *apply_relocate_add_write = memcpy;
> 
> $ touch 2.s
> $ cat 3.i
> enum { false, true } * __memcpy();

??  obviously bad reduction.

> _Bool kasan_check_range();
> void *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);
> }
> 
> long LZ4_decompress_generic_dst_restSize;
> char LZ4_decompress_generic_dst_lowPrefix;
> void LZ4_decompress_generic_dst() {
>   __builtin_memcpy(LZ4_decompress_generic_dst,
>                    &LZ4_decompress_generic_dst_lowPrefix,
>                    LZ4_decompress_generic_dst_restSize);

I wonder if this use of __builtin_memcpy intends to not use the
kernels always-inline memcpy but GCCs own inline expansion?
This obviously doesn't work, not with LTO at least.

It looks like with kasan enabled (and memcpy "wrapped") the
memcpy declaration should _not_ have the always-inline (since
the implementation is no longer always-inline).  That would be
a fix on the kernel side, but I'd also diagnose any such
always-inline "mismatch" we get to at WPA.

  parent reply	other threads:[~2021-03-31 10:05 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-30 13:14 [Bug lto/99828] New: " marxin at gcc dot gnu.org
2021-03-30 13:55 ` [Bug lto/99828] " rguenth at gcc dot gnu.org
2021-03-30 14:01 ` rguenth at gcc dot gnu.org
2021-03-30 17:44 ` andi-gcc at firstfloor dot org
2021-03-30 19:29 ` rguenther at suse dot de
2021-03-30 19:50 ` hubicka at ucw dot cz
2021-03-31  7:22 ` rguenth at gcc dot gnu.org
2021-03-31  9:16 ` hubicka at ucw dot cz
2021-03-31  9:29 ` marxin at gcc dot gnu.org
2021-03-31 10:05 ` rguenther at suse dot de [this message]
2021-03-31 11:56 ` marxin at gcc dot gnu.org
2022-09-22 10:58 ` jirislaby at gmail dot com
2022-09-22 10:59 ` jirislaby at gmail dot com
2022-09-22 11:20 ` rguenth at gcc dot gnu.org
2022-09-23  6:11 ` jirislaby at gmail dot com
2022-09-23 18:11 ` andi at firstfloor dot org
2022-09-23 19:50 ` marxin at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-99828-4-82QHwnIlrs@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).