[Bug c++/104635] for loop optimized into infinite loop

2022-02-22 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104635 --- Comment #10 from Jonathan Wakely --- (In reply to Szüllő Ádám from comment #8) > Yes, the code as a whole is invalid. > But for(int i=0; i<4; i++) is well defined. No, that's not how undefined behaviour works. It isn't bounded or localised

[Bug c++/104635] for loop optimized into infinite loop

2022-02-22 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104635 --- Comment #9 from Jonathan Wakely --- (In reply to Szüllő Ádám from comment #4) > i understand that missing return value is undefined behaviour. > my point is, that this should be limited to the act of return (return with > garbage, segfault,

[Bug c++/104635] for loop optimized into infinite loop

2022-02-22 Thread szullo.adam at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104635 --- Comment #8 from Szüllő Ádám --- Yes, the code as a whole is invalid. But for(int i=0; i<4; i++) is well defined.

[Bug c++/104635] for loop optimized into infinite loop

2022-02-22 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104635 --- Comment #7 from Jonathan Wakely --- It isn't well-defined code though. It's undefined, as you yourself said. It can't be both.

[Bug c++/104635] for loop optimized into infinite loop

2022-02-22 Thread szullo.adam at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104635 --- Comment #6 from Szüllő Ádám --- I'd bothered to read the articles, and there were no new information (nor relevant to this exact case). You are right that this is not a bug, becasue the code is invalid, as myself emphasized too in the descri

[Bug c++/104635] for loop optimized into infinite loop

2022-02-22 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104635 --- Comment #5 from Jakub Jelinek --- If you'd bothered to read the link I've provided (actually all 3 parts of it), maybe you'd understand. Anyway, bugzilla is for reporting bugs (there is none on the compiler side), not for teaching users ho

[Bug c++/104635] for loop optimized into infinite loop

2022-02-22 Thread szullo.adam at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104635 --- Comment #4 from Szüllő Ádám --- i understand that missing return value is undefined behaviour. my point is, that this should be limited to the act of return (return with garbage, segfault, stuck in an infinite loop _after_ the for loop) wha

[Bug c++/104635] for loop optimized into infinite loop

2022-02-22 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104635 Jakub Jelinek changed: What|Removed |Added CC||jakub at gcc dot gnu.org --- Comment #3

[Bug c++/104635] for loop optimized into infinite loop

2022-02-22 Thread szullo.adam at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104635 --- Comment #2 from Szüllő Ádám --- >There's nothing wrong here how a missing retun statement corrupt an independent code block, with "private" variable inside it's own scope?

[Bug c++/104635] for loop optimized into infinite loop

2022-02-22 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104635 Richard Biener changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|---