-Winline does not respect -fno-default-inline (this is split out of bug17115,
and a possible 3.3 regression).
Consider this code:
struct Foo {
int a(int r) { return r & 1; }
virtual int b(int r) { return r & 2; }
static int c(int r) { return r & 4; }
};
int bar(int r) {
Foo f; int k = 0;
k |= f.a(r); k |= f.b(r); k |= f.a(r);
return k;
}
> g++-3.3 -c -O2 -fno-default-inline -Winline test.cpp
> g++-3.4 -c -O2 -fno-default-inline -Winline test.cpp
test.cpp: In function `int bar(int)':
test.cpp:6: warning: inlining failed in call to 'int Foo::a(int)': --param
max-inline-insns-single limit reached
test.cpp:13: warning: called from here
test.cpp:7: warning: inlining failed in call to 'virtual int Foo::b(int)':
--param max-inline-insns-single limit reached
test.cpp:13: warning: called from here
test.cpp:6: warning: inlining failed in call to 'int Foo::a(int)': --param
max-inline-insns-single limit reached
test.cpp:13: warning: called from here
test.cpp:6: warning: inlining failed in call to 'int Foo::a(int)': --param
max-inline-insns-single limit reached
test.cpp:13: warning: called from here
test.cpp:7: warning: inlining failed in call to 'virtual int Foo::b(int)':
--param max-inline-insns-single limit reached
test.cpp:13: warning: called from here
test.cpp:6: warning: inlining failed in call to 'int Foo::a(int)': --param
max-inline-insns-single limit reached
test.cpp:13: warning: called from here
Futhermore, the warnings disappear if you use -O3 instead of -O2, so -O3 seems
to silently override -fno-default-inline (at least a documentation bug).
Full test program and log file will follow as attachment.
--
Summary: -Winline does not respect -fno-default-inline
Product: gcc
Version: 3.4.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: markus at oberhumer dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC host triplet: i386-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18071