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 c/59933] for loop goes wild with assert() enabled Date: Wed, 19 Feb 2014 15:49:00 -0000 [thread overview] Message-ID: <bug-59933-4-KGiUmokm5L@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-59933-4@http.gcc.gnu.org/bugzilla/> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59933 Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> --- The code is not invalid C, just triggers undefined behavior, so it is not invalid at compile time, just at runtime if you ever hit this. GCC optimizes based on the assumption that undefined behavior doesn't happen in a correct program. While we have -Waggressive-loop-optimizations warning, it (intentionally) warns solely about the case where the loop has single exit and constant loop iteration count, which is not the case here, the number of iterations is i >= 292 ? 0 : 292 - i. The loop will trigger undefined behavior whenever i is < 292, if it is bigger, then there is no bug.
next prev parent reply other threads:[~2014-02-19 15:49 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-01-24 12:56 [Bug c/59933] New: " warnerme at ptd dot net 2014-01-24 13:00 ` [Bug c/59933] " warnerme at ptd dot net 2014-01-29 12:25 ` ian at g0tcd dot com 2014-01-29 13:14 ` ian at g0tcd dot com 2014-02-19 8:36 ` mpolacek at gcc dot gnu.org 2014-02-19 12:27 ` warnerme at ptd dot net 2014-02-19 14:08 ` warnerme at ptd dot net 2014-02-19 14:54 ` mpolacek at gcc dot gnu.org 2014-02-19 15:49 ` jakub at gcc dot gnu.org [this message] 2014-02-19 16:12 ` ian at g0tcd dot com 2014-02-19 16:41 ` jakub at gcc dot gnu.org 2014-02-19 20:57 ` jakub at gcc dot gnu.org 2014-02-20 1:00 ` ian at g0tcd dot com
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-59933-4-KGiUmokm5L@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).