https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85652
Martin Sebor changed:
What|Removed |Added
Status|UNCONFIRMED |RESOLVED
CC||msebor at gcc dot gnu.org
Resolution|--- |INVALID
--- Comment #2 from Martin Sebor ---
As explained in comment #1, with -fpic extern functions are not considered
candidates for inlining because they can be superimposed. Without -fpic GCC
sees that the inlined function can return a string that's as long as 55
characters but with the option a superimposed implementation could be
guaranteed to return a shorter string. The same effect can be seen with other
middle-end warnings, including for example -Warray-bounds with the following
modified test case:
struct b
{
const char *h(int) const;
char c[4][56];
};
const char *b::h(int d) const
{
return c[d]; // no -Warray-bounds with -fpic
}
void f() {
b a;
__builtin_puts (a.h (99));
}