From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15205 invoked by alias); 9 Feb 2009 16:02:09 -0000 Received: (qmail 10958 invoked by uid 48); 9 Feb 2009 16:01:51 -0000 Date: Mon, 09 Feb 2009 16:02:00 -0000 Subject: [Bug c++/39140] New: g++ doesn't inline vararg functions X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "thomas dot bleher at philosys dot de" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2009-02/txt/msg00781.txt.bz2 In the code below, g++ should eliminate both function calls when called with -O2: $ cat > inline_varargs.c < 08048420 : $ gcc -O2 inline_varargs.c $ objdump -d a.out | grep Vararg 08048350 : 08048360 : $ g++ -v Using built-in specs. Target: i486-linux-gnu Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.2 --program-suffix=-4.2 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --disable-libmudflap --enable-targets=all --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu Thread model: posix gcc version 4.2.4 20080512 (prerelease) (Debian 4.2.3-6) As can be seen, gcc correclty inlines both functions, while g++ does not inline the varargs function. Trying to force inlining with __attribute__((always_inline)) leads to the following error message: inline_varargs.c: In function ‘int main()’: inline_varargs.c:3: sorry, unimplemented: inlining failed in call to ‘void Vararg(const char*, ...)’: function not inlinable inline_varargs.c:7: sorry, unimplemented: called from here This might be related to bug 10980, but as it works with gcc, I'm not sure what the problem really is. -- Summary: g++ doesn't inline vararg functions Product: gcc Version: 4.2.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: thomas dot bleher at philosys dot de http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39140