[Bug middle-end/97617] missing aggressive loop optimization warning in C++

2020-10-28 Thread jan.smets at nokia dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97617

--- Comment #3 from Jan Smets  ---
Sorry, I was too quickly in my wording to "skip single_exit()", of course that
edge is still required.

[Bug middle-end/97617] missing aggressive loop optimization warning in C++

2020-10-28 Thread jan.smets at nokia dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97617

--- Comment #2 from Jan Smets  ---
Is it maybe a possibility to report the (possible) false positives with
something like -Waggressive-loop-optimizations=2 ? 

Would that only require a skip of single_exit() in
do_warn_aggressive_loop_optimizations, or is there more to it? 
Thanks

[Bug middle-end/97617] missing aggressive loop optimization warning in C++

2020-10-28 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97617

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek  ---
The warning is documented to be done only for loops that don't have multiple
exits (because otherwise it would have too many false positives; when the loop
isn't guaranteed to loop 16 times, there might not be an UB).
As printf is a possible cancellation point, it isn't marked throw() in the C
headers, so if you compile with C++ and don't turn off exceptions, the result
is expected - there are EH edges out of the printf call that might terminate
the loop.