From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15880 invoked by alias); 13 Mar 2007 22:57:35 -0000 Received: (qmail 15862 invoked by uid 48); 13 Mar 2007 22:57:26 -0000 Date: Tue, 13 Mar 2007 22:57:00 -0000 Message-ID: <20070313225726.15861.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug c++/30988] [4.1/4.2/4.3 Regression] Incorrect "no return statement" warning with __attribute__ ((noreturn)) and __FUNCTION__ In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "spark at gcc dot gnu dot org" 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: 2007-03/txt/msg01223.txt.bz2 ------- Comment #3 from spark at gcc dot gnu dot org 2007-03-13 22:57 ------- This is somewhat complicated. The extra type cast causes different code paths to be taken. In particular, in finish_call_expr() in cp/semantics.c: if (processing_template_decl) { if (type_dependent_expression_p (fn) || any_type_dependent_arguments_p (args)) { result = build_nt_call_list (fn, args); KOENIG_LOOKUP_P (result) = koenig_p; return result; } if (!BASELINK_P (fn) && TREE_CODE (fn) != PSEUDO_DTOR_EXPR && TREE_TYPE (fn) != unknown_type_node) fn = build_non_dependent_expr (fn); args = build_non_dependent_args (orig_args); With the type cast, build_over_call() is called eventually which checks TREE_THIS_VOLATILE() for the callee function decl and mark the current function (i.e. caller A::g) as returns_abnormally. The lack of the type cast triggers any_type_dependent_arguments_p(args) above, leading to build_nt_call_list() which doesn't do this marking of the returns_abnormally. Now, not being familiar with the c++ frontend, I'm not sure where exactly we should do the checking of TREE_THIS_VOLATILE() for the callee decl. The following patch seems to fix the problem (though I can't even tell whether this is the right approach): diff -r 15a559a8fcf0 gcc/cp/semantics.c --- a/gcc/cp/semantics.c Mon Mar 12 15:38:22 2007 -0700 +++ b/gcc/cp/semantics.c Tue Mar 13 15:48:45 2007 -0700 @@ -1816,6 +1816,10 @@ finish_call_expr (tree fn, tree args, bo || any_type_dependent_arguments_p (args)) { result = build_nt_call_list (fn, args); + + if (fn && TREE_THIS_VOLATILE (fn) && cfun) + current_function_returns_abnormally = 1; + KOENIG_LOOKUP_P (result) = koenig_p; return result; } -- spark at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |spark at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30988