From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8BA1639DD40D; Thu, 12 Nov 2020 07:11:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8BA1639DD40D From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/64711] Unconsistency with -fnon-call-exceptions when used along inline and ipa optimizations and memmov Date: Thu, 12 Nov 2020 07:11:02 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 4.8.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cf_reconfirmed_on bug_status everconfirmed 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, 12 Nov 2020 07:11:02 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D64711 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2020-11-12 Status|UNCONFIRMED |NEW Ever confirmed|0 |1 --- Comment #4 from Richard Biener --- As Andrew says the reason is that C library builtins are marked nothrow whi= ch currently implies "notrap" in the context of -fnon-call-exceptions. There's no separate attribute for not trapping (or IPA discovery of this) but a simple enough workaround only pessimizing -fnon-call-exceptions would be sth like the following diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c index c3314bbd78c..bcf6a7fb348 100644 --- a/gcc/tree-eh.c +++ b/gcc/tree-eh.c @@ -2902,6 +2902,12 @@ stmt_could_throw_p (function *fun, gimple *stmt) return true; case GIMPLE_CALL: + /* ??? We need to check whether the callee can throw non-call + exceptions or conservatively assume so if we cannot tell but + non-call exceptions are enabled. */ + if (fun && fun->can_throw_non_call_exceptions + || flag_non_call_exceptions) + return true; return !gimple_call_nothrow_p (as_a (stmt)); case GIMPLE_COND: as the comments says the check isn't correct but it might work for simple non-LTO cases. Anybody willing to try?=