[Bug c++/92617] Invalid loop optimization: no exit condition

2019-11-21 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92617

--- Comment #6 from Andrew Pinski  ---
In c++ (unlike C) return from a non void function is undefined even if the
return value is not used.

In c, only of the return value is used it would be undefined.

[Bug c++/92617] Invalid loop optimization: no exit condition

2019-11-21 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92617

--- Comment #7 from Andrew Pinski  ---
Not you can get a runtime error if you use -fsanitizer=undefined.

[Bug c++/92617] Invalid loop optimization: no exit condition

2019-11-21 Thread piotr.seweryn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92617

--- Comment #5 from Piotr Seweryn  ---
Obviously there is no return statement and warning was issued, however endless
loop isn't the expected result, don't you agree? And falling-through to the
next piece of code is even worse, coze we are falling we random arguments and
weird things may happen.

[Bug c++/92617] Invalid loop optimization: no exit condition

2019-11-21 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92617

Richard Biener  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |INVALID

--- Comment #4 from Richard Biener  ---
You miss a return stmt.

[Bug c++/92617] Invalid loop optimization: no exit condition

2019-11-21 Thread piotr.seweryn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92617

--- Comment #3 from Piotr Seweryn  ---
Similar problem occurs when -O2 or -O3 is used, there is also an endless loop,
however different assembler code is generated. I can also provided appropriate
.ii and .s files for O2 and O3 case.

[Bug c++/92617] Invalid loop optimization: no exit condition

2019-11-21 Thread piotr.seweryn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92617

--- Comment #2 from Piotr Seweryn  ---
Created attachment 47324
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47324=edit
Assembler file

[Bug c++/92617] Invalid loop optimization: no exit condition

2019-11-21 Thread piotr.seweryn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92617

--- Comment #1 from Piotr Seweryn  ---
Created attachment 47323
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47323=edit
Pre-processed file