https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101270
Bug ID: 101270 Summary: error: inlining failed in call to ‘always_inline’ ‘open.localalias’: function not inlinable with -fPIC -fno-semantic-interposition Product: gcc Version: 12.0 Status: UNCONFIRMED Keywords: rejects-valid Severity: normal Priority: P3 Component: ipa 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: --- The following code snipped is rejected: $ cat large_mounts.i typedef struct { } __fpos_t; extern __inline __attribute__((__always_inline__)) __attribute__((__gnu_inline__)) __attribute__((__artificial__)) int open(const char *__path, int __oflag, ...) { return 0; } int open(const char *path, int flags, ...) { int mounts_fd; mounts_fd = open("/proc/mounts", 00); return mounts_fd; } $ gcc large_mounts.i -c -O2 -fPIC -fno-semantic-interposition large_mounts.i: In function ‘open’: large_mounts.i:6:5: error: inlining failed in call to ‘always_inline’ ‘open.localalias’: function not inlinable 6 | int open(const char *path, int flags, ...) { | ^~~~ large_mounts.i:8:15: note: called from here 8 | mounts_fd = open("/proc/mounts", 00); | ^~~~~~~~~~~~~~~~~~~~~~~~ while clang accepts it: $ clang large_mounts.i -c -O2 -fPIC -fno-semantic-interposition Moreover, we reject also with: gcc large_mounts.i -c -O2 -fPIC large_mounts.i: In function ‘open’: large_mounts.i:6:5: error: inlining failed in call to ‘always_inline’ ‘open.localalias’: redefined extern inline functions are not considered for inlining 6 | int open(const char *path, int flags, ...) { | ^~~~ large_mounts.i:8:15: note: called from here 8 | mounts_fd = open("/proc/mounts", 00); | ^~~~~~~~~~~~~~~~~~~~~~~~ this one is rejected since r8-2126-g325fe81618c822b8.