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();
_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);
}

$ gcc 1.i -c -flto && gcc 3.i -c -flto -Os -fno-builtin && gcc -r [13].o 2.s
/usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld:
warning: incremental linking of LTO and non-LTO objects; using
-flinker-output=nolto-rel which will bypass whole program optimization
3.i: In function ‘LZ4_decompress_generic_dst’:
1.i:2:1: error: inlining failed in call to ‘always_inline’ ‘memcpy’: --param
max-inline-insns-auto limit reached
    2 | memcpy();
      | ^
3.i:11:3: note: called from here
   11 |   __builtin_memcpy(LZ4_decompress_generic_dst,
      |   ^
lto-wrapper: fatal error: gcc returned 1 exit status
compilation terminated.
/usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld:
error: lto-wrapper failed
collect2: error: ld returned 1 exit status

Reply via email to