public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/104986] [12/13/14 Regression] bogus writing 1 byte into a region of size 0 with -fwrapv and -O2 -fpeel-loops since r12-4698-gf6d012338bf87f42 Date: Sat, 02 Sep 2023 20:02:51 +0000 [thread overview] Message-ID: <bug-104986-4-g3Zd7n2s0m@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-104986-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104986 Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |needs-bisection Known to work| |13.1.0 --- Comment #13 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Looks like SCEV can figure out the bounds more correctly in GCC 13+ which fixes the warning and the missed optimization. GCC 12.3.0: ``` Estimating # of iterations of loop 1 Matching expression match.pd:2119, generic-match.cc:693 Matching expression match.pd:2122, generic-match.cc:753 Matching expression match.pd:2129, generic-match.cc:776 Analyzing # of iterations of loop 1 exit condition [prephitmp_30, + , -1] != 0 bounds on difference of bases: -5 ... 1 Applying pattern match.pd:182, generic-match.cc:30997 Applying pattern match.pd:5698, generic-match.cc:11425 Matching expression match.pd:2119, generic-match.cc:693 Matching expression match.pd:2122, generic-match.cc:753 Matching expression match.pd:2129, generic-match.cc:776 Applying pattern match.pd:354, generic-match.cc:5780 result: # of iterations (unsigned int) prephitmp_30, bounded by 4294967295 Statement (exit)if (nb_24 != 0) is executed at most (unsigned int) prephitmp_30 (bounded by 4294967295) + 1 times in loop 1. ``` While GCC 13+: ``` Estimating # of iterations of loop 1 Matching expression match.pd:2404, generic-match.cc:727 Matching expression match.pd:2407, generic-match.cc:787 Matching expression match.pd:2414, generic-match.cc:810 Analyzing # of iterations of loop 1 exit condition [prephitmp_30, + , -1] != 0 bounds on difference of bases: -5 ... 0 Applying pattern match.pd:182, generic-match.cc:33250 Applying pattern match.pd:6155, generic-match.cc:21253 Matching expression match.pd:2404, generic-match.cc:727 Matching expression match.pd:2407, generic-match.cc:787 Matching expression match.pd:2414, generic-match.cc:810 Applying pattern match.pd:365, generic-match.cc:21998 result: # of iterations (unsigned int) prephitmp_30, bounded by 5 Statement (exit)if (nb_24 != 0) is executed at most (unsigned int) prephitmp_30 (bounded by 5) + 1 times in loop 1. ```
prev parent reply other threads:[~2023-09-02 20:02 UTC|newest] Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-03-19 17:07 [Bug middle-end/104986] New: [12 Regression] bogus writing 1 byte into a region of size 0 with -fwrapv and -O2 -fpeel-loops andres at anarazel dot de 2022-03-21 8:53 ` [Bug middle-end/104986] " rguenth at gcc dot gnu.org 2022-03-21 9:31 ` [Bug middle-end/104986] [12 Regression] bogus writing 1 byte into a region of size 0 with -fwrapv and -O2 -fpeel-loops since r12-4698-gf6d012338bf87f42 marxin at gcc dot gnu.org 2022-03-23 9:45 ` aldyh at gcc dot gnu.org 2022-03-23 13:05 ` rguenth at gcc dot gnu.org 2022-03-23 14:45 ` aldyh at gcc dot gnu.org 2022-03-23 14:46 ` amacleod at redhat dot com 2022-03-23 14:49 ` aldyh at gcc dot gnu.org 2022-03-23 14:58 ` amacleod at redhat dot com 2022-03-23 15:05 ` rguenth at gcc dot gnu.org 2022-04-19 5:20 ` jakub at gcc dot gnu.org 2022-05-06 8:33 ` [Bug middle-end/104986] [12/13 " jakub at gcc dot gnu.org 2022-07-26 12:38 ` rguenth at gcc dot gnu.org 2023-05-08 12:24 ` [Bug middle-end/104986] [12/13/14 " rguenth at gcc dot gnu.org 2023-09-02 20:02 ` pinskia at gcc dot gnu.org [this message]
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-104986-4-g3Zd7n2s0m@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).