This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

'g++ -Winline -O' reports bogus inlining failure for destructors even without their declaration?


Hi everyone,

I'm Edward-san, a contributor developer of cppcheck (link:
http://cppcheck.sourceforge.net/ ) and I noticed a strange thing when
I was compiling it with some particular flags.
It happens with gcc 4.5.2 (the supplied one from Linux Mint 11
packages), gcc 4.6.3 (the one which came out from Ubuntu 12.04) and in
gcc 4.7.1 (compiled by myself).

To reproduce the problem, download the source here:
https://github.com/danmar/cppcheck/zipball/master and unzip it
somewhere.

In the new folder, write in the terminal: "make lib/errorlogger.o
'CXXFLAGS=-Winline -O' "
g++ will output these messages:

g++  -Winline -O -Ilib -c -o lib/errorlogger.o lib/errorlogger.cpp
lib/errorlogger.h: In member function ‘void
ErrorLogger::reportUnmatchedSuppressions(const
std::list<Suppressions::SuppressionEntry>&)’:
lib/errorlogger.h:147:36: warning: inlining failed in call to
‘ErrorLogger::ErrorMessage::~ErrorMessage()’: call is unlikely and
code size would grow
lib/errorlogger.cpp:342:143: warning: called from here

but in lib/errorlogger.cpp/h there's no declaration of the
ErrorLogger::ErrorMessage destructor.

If you compile the program with that options, ie: "make
'CXXFLAGS=-Winline -O' " you'll get

It isn't possible to reproduce this without '-O'.

Maybe I don't know something about this... if it's not a false
positive, what would it be the way to fix this? Do you need the
preprocessed source?

g++ -v output:
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro
4.5.2-8ubuntu4'
--with-bugurl=file:///usr/share/doc/gcc-4.5/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.5 --enable-shared --enable-multiarch
--with-multiarch-defaults=x86_64-linux-gnu --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib/x86_64-linux-gnu
--without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.5
--libdir=/usr/lib/x86_64-linux-gnu --enable-nls --with-sysroot=/
--enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --enable-plugin --enable-gold
--enable-ld=default --with-plugin-ld=ld.gold --enable-objc-gc
--disable-werror --with-arch-32=i686 --with-tune=generic
--enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.5.2 (Ubuntu/Linaro 4.5.2-8ubuntu4)

Sincerely,
Edward-san


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]