public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/112807] ICE: SIGSEGV in contains_struct_check (tree.h:3747) with _BitInt() at -O1 and above Date: Fri, 01 Dec 2023 17:03:11 +0000 [thread overview] Message-ID: <bug-112807-4-kiOm9hKbHI@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-112807-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112807 --- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Ah, the problem is that lower_addsub_overflow was written for lowering of large/huge _BitInt operations, so for .{ADD,SUB}_OVERFLOW where one of the 2 operands is in the x86_64 case at least 129 bit or the result is a complex type with 129+ bit element type. That is the case here, because the first operand is _BitInt(256), but as result is just 32-bit and VRP tells us the first argument is in [0, 0xffffffff] range which needs 32-bits unsigned and the second argument is in [-2, 1] range, we don't actually cast the second argument to a large/huge _BitInt type and so it fails miserably. Now, we could fix that either by tweaking the tree type0 = TREE_TYPE (arg0); tree type1 = TREE_TYPE (arg1); if (TYPE_PRECISION (type0) < prec3) { type0 = build_bitint_type (prec3, TYPE_UNSIGNED (type0)); if (TREE_CODE (arg0) == INTEGER_CST) arg0 = fold_convert (type0, arg0); } if (TYPE_PRECISION (type1) < prec3) { type1 = build_bitint_type (prec3, TYPE_UNSIGNED (type1)); if (TREE_CODE (arg1) == INTEGER_CST) arg1 = fold_convert (type1, arg1); } such that if bitint_precision_kind (prec3) < bitint_prec_large we actually use smallest possible bitint_prec_large, or during the preparation phase check if .{ADD,SUB}_OVERFLOW with small/medium return and both operands with range_for_prec absolute values also small/medium we actually turn it into a small/medium .{ADD,SUB}_OVERFLOW and expand just the casts.
next prev parent reply other threads:[~2023-12-01 17:03 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-12-01 9:56 [Bug tree-optimization/112807] New: " zsojka at seznam dot cz 2023-12-01 17:03 ` jakub at gcc dot gnu.org [this message] 2023-12-01 17:52 ` [Bug tree-optimization/112807] " jakub at gcc dot gnu.org 2023-12-03 16:54 ` cvs-commit at gcc dot gnu.org 2023-12-03 16:56 ` jakub at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-112807-4-kiOm9hKbHI@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).