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.

Reply via email to