From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 4D5F53858417; Sat, 20 Jan 2024 11:37:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4D5F53858417 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1705750646; bh=5JASFfMiNat/Mz69r4pwc9l2vgbX7jVOM/yqUgrPklc=; h=From:To:Subject:Date:In-Reply-To:References:From; b=lX6rkxwe4sN4c6ESXryZAplF2aQVQquK4ymvRR+VLU67flqXHuAOUtILy7ZNz3obO 6vmNXZsTFE9HdFYlMoMt1ncoXzY/GMbR/8cNVo9gqqWYnr4MaEMS5BsG0+tKZT9sQv 7YhHbuQk+fOWgeakDA+KqnNJEegtO3vbaP0f4MA0= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/113491] ICE: SIGSEGV in make_ssa_name_fn (tree-ssanames.cc:354) at -Os with _BitInt() used as switch control expression Date: Sat, 20 Jan 2024 11:37:24 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 14.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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D113491 --- Comment #3 from GCC Commits --- The master branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:291e00e2d88a352f46cd539e3c5785982dc3fdd9 commit r14-8302-g291e00e2d88a352f46cd539e3c5785982dc3fdd9 Author: Jakub Jelinek Date: Sat Jan 20 12:35:38 2024 +0100 tree-switch-conversion: Bugfixes for _BitInt [PR113491] The following patch fixes various issues with large/huge _BitInt used as switch expressions. In particular: 1) the indexes in CONSTRUCTORs shouldn't be types with precision larger than sizetype precision, varasm uses wi::to_offset on those and too large indexes ICE; we've already checked earlier that the cluster is at mo= st sizetype bits and arrays can't be larger than that anyway 2) some spots were using SCALAR_INT_TYPE_MODE or lang_hooks.types.type_for_mode on TYPE_MODE to determine types to us= e, that obviously doesn't work for the large/huge BITINT_TYPE 3) like the recent change in the C FE, this patch makes sure we don't create ARRAY_REFs with indexes with precision above sizetype precision, bec= ause bitint lowering isn't prepared for that and because the indexes can'= t be larger than sizetype anyway; the subtraction of the cluster minimum = from the index obviously needs to be done in unsigned __int128 or large/h= uge BITINT_TYPE, but then we cast to sizetype if the precision is larger than sizetype 2024-01-20 Jakub Jelinek PR tree-optimization/113491 * tree-switch-conversion.cc (switch_conversion::build_constructors): If elt.index has precision higher than sizetype, fold_convert i= t to sizetype. (switch_conversion::array_value_type): Return type if type is BITINT_TYPE with precision above MAX_FIXED_MODE_SIZE or with BLKmode. (switch_conversion::build_arrays): Use unsigned_type_for rather than lang_hooks.types.type_for_mode if utype is BITINT_TYPE with precision above MAX_FIXED_MODE_SIZE or with BLKmode. If utype has precis= ion higher than sizetype, use sizetype as tidx type and fold_convert the subtraction to sizetype. * gcc.dg/torture/bitint-51.c: New test.=