public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug lto/99828] New: inlining failed in call to ‘always_inline’ ‘memcpy’: --param max-inline-insns-auto limit reached
@ 2021-03-30 13:14 marxin at gcc dot gnu.org
  2021-03-30 13:55 ` [Bug lto/99828] " rguenth at gcc dot gnu.org
                   ` (15 more replies)
  0 siblings, 16 replies; 17+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-03-30 13:14 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 99828
           Summary: inlining failed in call to ‘always_inline’ ‘memcpy’:
                    --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 = 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: ‘always_inline’ function might not be inlinable
[-Wattributes]
    1 | __attribute__((__always_inline__)) void *memcpy();
      |                                          ^~~~~~
3.i:5:1: warning: conflicting types for built-in function ‘memcpy’; expected
‘void *(void *, const void *, long unsigned int)’
[-Wbuiltin-declaration-mismatch]
    5 | memcpy(void *dest, void *src, long len) {
      | ^~~~~~
3.i:1:1: note: ‘memcpy’ is declared in header ‘<string.h>’
  +++ |+#include <string.h>
    1 | int kasan_check_range();
3.i:13:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
   13 | LZ4_decompress_generic_outputSize_match() {
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1.i:1:42: warning: type of ‘memcpy’ 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) {
      | ^
<built-in>: warning: type of ‘__builtin_memcpy’ does not match original
declaration [-Wlto-type-mismatch]
3.i:5:1: note: return value type mismatch
3.i:5:1: note: ‘memcpy’ was previously declared here
3.i:5:1: note: code may be misoptimized unless ‘-fno-strict-aliasing’ is used
3.i: In function ‘LZ4_decompress_generic_outputSize_match’:
1.i:1:42: error: inlining failed in call to ‘always_inline’ ‘memcpy’: --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

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2022-09-23 19:50 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-30 13:14 [Bug lto/99828] New: inlining failed in call to ‘always_inline’ ‘memcpy’: --param max-inline-insns-auto limit reached 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
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

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).