From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32539 invoked by alias); 16 Aug 2012 00:07:03 -0000 Received: (qmail 32521 invoked by uid 22791); 16 Aug 2012 00:07:02 -0000 X-SWARE-Spam-Status: No, hits=-4.2 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,KHOP_THREADED,TW_BJ,TW_CX,TW_DC,TW_GX X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 16 Aug 2012 00:06:49 +0000 From: "travis at gockelhut dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/54278] __attribute__((noreturn)) called from destructor when another auto-scoped variable has a non-trivial dtor erroneously fails with "control reaches end of non-void function" at -O0 Date: Thu, 16 Aug 2012 00:07:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: travis at gockelhut dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Version Summary Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 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: 2012-08/txt/msg01004.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54278 Travis Gockel changed: What |Removed |Added ---------------------------------------------------------------------------- Version|unknown |4.7.0 Summary|"control reaches end of |__attribute__((noreturn)) |non-void function |called from destructor when | |another auto-scoped | |variable has a non-trivial | |dtor erroneously fails with | |"control reaches end of | |non-void function" at -O0 --- Comment #1 from Travis Gockel 2012-08-16 00:06:48 UTC --- Accidentally hit enter... The key here is that ThingWithDtor is non-trivial -- if you mark ~ThingWithDtor() as =default (or remove the declaration), it will not warn. If you call a noreturn function directly instead of relying on ~Aborter(), it will not warn. If both branches of the if create an Aborter, it will not warn. Everything must be compiled with -Wreturn-type and -O0. This all compiles just fine with g++ 4.6.3. --- Using built-in specs. COLLECT_GCC=g++-4.7 COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.7.0-7ubuntu3' --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs --enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.7 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7 --libdir=/usr/lib --enable-nls --disable-bootstrap --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --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.7.0 (Ubuntu/Linaro 4.7.0-7ubuntu3)