From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B30FF3858404; Thu, 18 Apr 2024 07:45:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B30FF3858404 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1713426359; bh=+a+x6gTDeqH6qZicZ5stn1F77tui3GW43G6RTbitk9g=; h=From:To:Subject:Date:In-Reply-To:References:From; b=yCoaEx62CMm96xmRCMPNw3DiF//bivB6EPdJNaNDzLtl/wNaXpTXLeDusyCsnZryB aPXsJHJnJ9pmLxiwVGRSDMHmk3pCCZL9GNWfNNRt+wcU+Q+kkYIeheGBQu5jKbY3s8 lgfzZCBUWO5OnQCUbXu2H8omPWTyNb05VDFIEVo4= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/114753] from_chars aborts with -m32 -ftrapv when passed -9223372036854775808 Date: Thu, 18 Apr 2024 07:45:58 +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: 14.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: jakub at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D114753 --- Comment #7 from GCC Commits --- The master branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:6c152c9db3b5b9d43e12846fb7a44977c0b65fc2 commit r14-10012-g6c152c9db3b5b9d43e12846fb7a44977c0b65fc2 Author: Jakub Jelinek Date: Thu Apr 18 09:45:14 2024 +0200 internal-fn: Temporarily disable flag_trapv during .{ADD,SUB,MUL}_OVERF= LOW etc. expansion [PR114753] __builtin_{add,sub,mul}_overflow{,_p} builtins are well defined for all inputs even for -ftrapv, and the -fsanitize=3Dsigned-integer-ov= erflow ifns shouldn't abort in libgcc but emit the desired ubsan diagnostics or abort depending on -fsanitize* setting regardless of -ftrapv. The expansion of these internal functions uses expand_expr* in various places (e.g. MULT_EXPR at least in 2 spots), so temporarily disabling flag_trapv in all those spots would be hard. The following patch disables it around the bodies of 3 functions which can do the expand_expr calls. If it was in the C++ FE, I'd use some RAII sentinel, but I don't think we have one in the middle-end. 2024-04-18 Jakub Jelinek PR middle-end/114753 * internal-fn.cc (expand_mul_overflow): Save flag_trapv and temporarily clear it for the duration of the function, then restore previous value. (expand_vector_ubsan_overflow): Likewise. (expand_arith_overflow): Likewise. * gcc.dg/pr114753.c: New test.=