From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3485538346BB; Tue, 10 May 2022 08:26:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3485538346BB From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/105211] ICE: SIGSEGV in contains_struct_check (tree.h:3570) with -Os -ffast-math and __builtin_roundf() Date: Tue, 10 May 2022 08:26:18 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: ice-on-valid-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 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: Tue, 10 May 2022 08:26:19 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105211 --- Comment #6 from CVS Commits --- The releases/gcc-10 branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:b2a09805d7df2d3ba3b8f27161cc37809f37d27a commit r10-10707-gb2a09805d7df2d3ba3b8f27161cc37809f37d27a Author: Jakub Jelinek Date: Tue Apr 12 09:16:06 2022 +0200 builtins: Fix up expand_builtin_int_roundingfn_2 [PR105211] The expansion of __builtin_iround{,f,l} etc. builtins in some cases emits calls to a different fallback builtin. To locate the right built= in it uses mathfn_built_in_1 with the type of the first argument. If its TYPE_MAIN_VARIANT is {float,double,long_double}_type_node, all is fine, but on the following testcase, because GIMPLE considers scalar float conversions between types with the same mode as useless, TYPE_MAIN_VARIANT of the arg's type is float32_type_node and because th= ere isn't __builtin_lroundf32 returns NULL and we ICE. This patch will first try the type of the first argument of the builtin= 's prototype (so that say on sizeof(double)=3D=3Dsizeof(long double) targe= t it honors whether it was a *l or non-*l call; though even that can't be 100% trus= ted, user could incorrectly prototype it) and as fallback the type argument. If neither works, doesn't fallback. 2022-04-11 Jakub Jelinek PR rtl-optimization/105211 * builtins.c (expand_builtin_int_roundingfn_2): If mathfn_built_in_1 fails for TREE_TYPE (arg), retry it with TREE_VALUE (TYPE_ARG_TYPES (TREE_TYPE (fndecl))) and if even th= at fails, emit call normally. * gcc.dg/pr105211.c: New test. (cherry picked from commit 91a38e8a848c61b2e23ee277306dc8cd194d135b)=