From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D99BA385E00B; Thu, 26 Mar 2020 13:58:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D99BA385E00B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1585231122; bh=WJ5GyUDLGv0vCSyied+3tWH+aMoe6nuOjCD7dP4UnfU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=J7uZeRkvjr3RAELRylzmvxWVLnQ9E2NGv6GliwGYHhPvRyc3GQUqK7ScvCf3ijdPr S7r5seityPpeNzXOoxDbBpZX3g+8q7fEai/DVW7AQyjB8urQUfmQTGJ6QlN8oKHS3m GKNCgmIZH47/bdqPxdidf00Ad1bzJQQqXTFrfJoE= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: =?UTF-8?B?W0J1ZyBjKysvOTQzMjZdIGcrKzogZXJyb3I6IHBhY2suaWk6IA==?= =?UTF-8?B?4oCYLWZjb21wYXJlLWRlYnVn4oCZIGZhaWx1cmUgKGxlbmd0aCk=?= Date: Thu, 26 Mar 2020 13:58:42 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 10.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Mar 2020 13:58:43 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94326 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jason at gcc dot gnu.org --- Comment #3 from Jakub Jelinek --- And the reason for the differences is that with -Wno-return-local-addr (or = -w etc.) m_fn1 is marked TREE_NOTHROW (fndecl) in finish_function, while with -Wreturn-local-addr (and without -w) it is not. The difference is in cp_function_chain->can_throw , which set not set in th= e no warning case, and is set in: #0 set_flags_from_callee (call=3D) at ../../gcc/cp/call.c:324 #1 0x0000000000966d3b in build_call_a (function=3D, n=3D2, argarray=3D0x7fffffffb1e0) at ../../gcc/cp/call.c:365 #2 0x000000000098936f in build_cxx_call (fn=3D, nargs=3D2, argarray=3D0x7fffffffb1e0, complain=3D128, orig_fndecl=3D) at ../../gcc/cp/call.c:9578 #3 0x00000000009877cc in build_over_call (cand=3D0x3763930, flags=3D3, com= plain=3D0) at ../../gcc/cp/call.c:9082 #4 0x000000000098c868 in build_new_method_call_1 (instance=3D, fns=3D,=20 args=3D0x7fffffffb860 =3D {...}, conversion_path=3D, flags=3D1, fn_p=3D0x0, complain=3D128) at ../../gcc/cp/call.c:10335 #5 0x000000000098cd56 in build_new_method_call (instance=3D, fns=3D,=20 args=3D0x7fffffffb860 =3D {...}, conversion_path=3D, flags=3D= 1, fn_p=3D0x0, complain=3D128) at ../../gcc/cp/call.c:10410 #6 0x0000000000c41d6f in tsubst_copy_and_build (t=3D, args=3D, complain=3D128, in_decl=3D,=20 function_p=3Dfalse, integral_constant_expression_p=3Dfalse) at ../../gcc/cp/pt.c:19812 #7 0x0000000000c2ae69 in tsubst (t=3D, args=3D, complain=3D0, in_decl=3D) at ../../gcc/cp/pt.c:15746 #8 0x0000000000ac831c in dump_template_bindings (pp=3D0x34be940 , parms=3D, args=3D,=20 typenames=3D0x7fffea950a28 =3D {...}) at ../../gcc/cp/error.c:414 #9 0x0000000000ace590 in dump_substitution (pp=3D0x34be940 , t=3D,=20 template_parms=3D, template_args=3D, flags=3D132) at ../../gcc/cp/error.c:1560 #10 0x0000000000ad0138 in dump_function_decl (pp=3D0x34be940 , t=3D, flags=3D= 132) at ../../gcc/cp/error.c:1718 #11 0x0000000000acd485 in dump_decl (pp=3D0x34be940 , t=3D, flags=3D132) at ../../gcc/cp/error.c:1290 #12 0x0000000000ad6ba8 in decl_to_string (decl=3D, verbose=3D1) at ../../gcc/cp/error.c:3092 #13 0x0000000000ada974 in cp_printer (pp=3D0x370bbb0, text=3D0x7fffffffc550, spec=3D0x3721f62 "D", precision=3D0, wide=3Dfalse, set_locus=3Dfalse,=20 verbose=3Dtrue, quoted=3D0x7fffffffc19f, buffer_ptr=3D0x3721d70) at ../../gcc/cp/error.c:4260 #14 0x00000000026f5fe2 in pp_format (pp=3D0x370bbb0, text=3D0x7fffffffc550)= at ../../gcc/pretty-print.c:1458 #15 0x00000000026f63b2 in pp_format_verbatim (pp=3D0x370bbb0, text=3D0x7fffffffc550) at ../../gcc/pretty-print.c:1519 #16 0x00000000026f6c1d in pp_verbatim (pp=3D0x370bbb0, msg=3D0x2813680 "req= uired from %q#D\n") at ../../gcc/pretty-print.c:1773 #17 0x0000000000ad8b73 in print_instantiation_partial_context_line (context=3D0x36bc320 , t=3D0x7fffea956440,=20 loc=3D2147483653, recursive_p=3Dfalse) at ../../gcc/cp/error.c:3537 #18 0x0000000000ad8e6d in print_instantiation_partial_context (context=3D0x36bc320 , t0=3D0x7fffea936860, loc=3D2147483653) at ../../gcc/cp/error.c:3625 #19 0x0000000000ad89fb in print_instantiation_full_context (context=3D0x36b= c320 ) at ../../gcc/cp/error.c:3505 #20 0x0000000000ad8eec in maybe_print_instantiation_context (context=3D0x36= bc320 ) at ../../gcc/cp/error.c:3642 #21 0x0000000000ad74c6 in cp_diagnostic_starter (context=3D0x36bc320 , diagnostic=3D0x7fffffffc880) at ../../gcc/cp/error.c:3341 #22 0x00000000026cfced in diagnostic_report_diagnostic (context=3D0x36bc320 , diagnostic=3D0x7fffffffc880) at ../../gcc/diagnostic.c:1160 #23 0x00000000026d02f2 in diagnostic_impl (richloc=3D0x7fffffffc8f0, metadata=3D0x0, opt=3D635, gmsgid=3D0x284c5f8 "returning reference to tempo= rary",=20 ap=3D0x7fffffffc9a0, kind=3DDK_WARNING) at ../../gcc/diagnostic.c:1309 #24 0x00000000026d0b70 in warning_at (location=3D247168, opt=3D635, gmsgid=3D0x284c5f8 "returning reference to temporary") i.e. when the warning is being emitted. The call in question is A<>::m_fn2 (&((struct B *) this)->_M_t, TARGET_EXPR So, shall set_flags_from_callee be setting cp_function_chain->can_throw (or other flags) even in cp_unevaluated_operand ? Or shouldn't tsubst or whate= ver else sets cp_unevaluated_operand? Something else?=