public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/94392] [10 Regression] Infinite loops are optimized away for C99
Date: Wed, 01 Apr 2020 07:44:45 +0000	[thread overview]
Message-ID: <bug-94392-4-rE59eR28ND@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-94392-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94392

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org
           Priority|P3                          |P1
             Status|UNCONFIRMED                 |ASSIGNED
           Keywords|                            |wrong-code
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2020-04-01

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
Nice testcase btw ;)  I think to fix it you simply need to add an exit when
the search space is exhausted, thus when c > MAX do not reset it but return 0.

I understand that the while (1) { } style loop doesn't fall under the
"iteration statement whose controlling expression is not constant"
case.

Encoding this in the IL (struct loop) would be nice - we would need to
add a finite_p flag (so loosing it on the way only creates missed
optimizations,
not wrong-code) and populate that via either the existing ANNOTATE_EXPR
machinery or some langhook (note this would be queried after CFG build and thus
after IL lowering which might be too late for FEs to recover the original
loop construct).

Confirmed and mine.

  parent reply	other threads:[~2020-04-01  7:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-29 21:13 [Bug c/94392] New: " krister.walfridsson at gmail dot com
2020-03-29 21:22 ` [Bug c/94392] " pinskia at gcc dot gnu.org
2020-03-30  8:21 ` [Bug c/94392] [10 Regression] " rguenth at gcc dot gnu.org
2020-03-30 23:36 ` joseph at codesourcery dot com
2020-03-31  6:34 ` rguenther at suse dot de
2020-04-01  7:44 ` rguenth at gcc dot gnu.org [this message]
2020-04-02 14:53 ` cvs-commit at gcc dot gnu.org
2020-04-02 14:54 ` rguenth at gcc dot gnu.org
2020-04-03  8:10 ` cvs-commit 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-94392-4-rE59eR28ND@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: link
Be 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).