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/97556] [11 Regression] ICE at -O2 and -O3 in 32-bit mode on x86_64-pc-linux-gnu in size_remaining, at builtins.c:235 since r11-3827 Date: Mon, 26 Oct 2020 10:28:14 +0000 [thread overview] Message-ID: <bug-97556-4-AdqqEDUuRe@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-97556-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97556 --- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> --- I think the problem is that compute_objsize doesn't bother to check for any kind of overflow on any arithmetics it does. E.g. in: 4815 offset_int sz = wi::to_offset (tpsize); 4816 orng[0] *= sz; 4817 orng[1] *= sz; when orng[0] is 1000000000 and orng[1] is -1 and sz is 3, everything is multiplied by 3, so we end up with 3000000000 and -3. Later on the upper bound is set to 311 offset_int maxoff = wi::to_offset (TYPE_MAX_VALUE (ptrdiff_type_node)); 312 offrng[1] = maxoff; and size_remaining then asserts something that the computation can't really guarantee. Adjusted testcase that ICEs with -O2 -m64 the same way: char a[1][3]; int b; void f () { unsigned long long c = 7000000000000000000ULL; if (b) goto L; while (b) { c = ~0ULL; L: a[c][0] = 0; } }
next prev parent reply other threads:[~2020-10-26 10:28 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-10-23 19:29 [Bug tree-optimization/97556] New: ICE at -O2 and -O3 in 32-bit mode on x86_64-pc-linux-gnu in size_remaining, at builtins.c:235 su at cs dot ucdavis.edu 2020-10-24 8:19 ` [Bug tree-optimization/97556] [11 Regression] ICE at -O2 and -O3 in 32-bit mode on x86_64-pc-linux-gnu in size_remaining, at builtins.c:235 since r11-3827 jakub at gcc dot gnu.org 2020-10-26 10:28 ` jakub at gcc dot gnu.org [this message] 2020-10-30 16:51 ` msebor at gcc dot gnu.org 2020-10-30 19:05 ` cvs-commit at gcc dot gnu.org 2020-10-30 19:13 ` msebor 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-97556-4-AdqqEDUuRe@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).