public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/99204] [8/9 Regression] ICE in fold_read_from_constant_string, at fold-const.c:15441 Date: Thu, 22 Apr 2021 16:51:18 +0000 [thread overview] Message-ID: <bug-99204-4-AiQF1U1Mw6@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-99204-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99204 --- Comment #12 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-8 branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>: https://gcc.gnu.org/g:f843203ea2c65d6319d784079baa8375c406a52c commit r8-10890-gf843203ea2c65d6319d784079baa8375c406a52c Author: Jakub Jelinek <jakub@redhat.com> Date: Tue Feb 23 09:49:48 2021 +0100 fold-const: Fix ICE in fold_read_from_constant_string on invalid code [PR99204] fold_read_from_constant_string and expand_expr_real_1 have code to optimize constant reads from string (tree vs. rtl). If the STRING_CST array type has zero low bound, index is fold converted to sizetype and so the compare_tree_int works fine, but if it has some other low bound, it calls size_diffop_loc and that function from 2 sizetype operands creates a ssizetype difference. expand_expr_real_1 then uses tree_fits_uhwi_p + compare_tree_int and so works fine, but fold-const.c only checked if index is INTEGER_CST and calls compare_tree_int, which means for negative index it will succeed and result in UB in the compiler. 2021-02-23 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/99204 * fold-const.c (fold_read_from_constant_string): Check that tree_fits_uhwi_p (index) rather than just that index is INTEGER_CST. * gfortran.dg/pr99204.f90: New test. (cherry picked from commit f53a9b563b5017af179f1fd900189c0ba83aa2ec)
next prev parent reply other threads:[~2021-04-22 16:51 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-02-22 16:56 [Bug fortran/99204] New: " gscfq@t-online.de 2021-02-22 16:57 ` [Bug fortran/99204] " gscfq@t-online.de 2021-02-22 17:02 ` dominiq at lps dot ens.fr 2021-02-22 17:19 ` gscfq@t-online.de 2021-02-22 17:46 ` anlauf at gcc dot gnu.org 2021-02-22 18:50 ` [Bug tree-optimization/99204] [8/9/10/11 Regression] " jakub at gcc dot gnu.org 2021-02-22 18:58 ` jakub at gcc dot gnu.org 2021-02-23 8:51 ` cvs-commit at gcc dot gnu.org 2021-02-23 9:12 ` [Bug tree-optimization/99204] [8/9/10 " jakub at gcc dot gnu.org 2021-03-19 23:29 ` cvs-commit at gcc dot gnu.org 2021-03-20 8:08 ` [Bug tree-optimization/99204] [8/9 " jakub at gcc dot gnu.org 2021-04-20 23:32 ` cvs-commit at gcc dot gnu.org 2021-04-22 16:51 ` cvs-commit at gcc dot gnu.org [this message] 2021-04-22 17:11 ` 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-99204-4-AiQF1U1Mw6@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).