As a matter of fact, the line numbers for a crash rely on the -g flag, and not the -O flag.
I debug my local code compiled with O3 and g and it is still able to provide filenames and line numbers of any crash.
Also, the O3 creating bugs is more of a legend imho, haven't ever had any problem (maybe you get some in embed system or kernel corner cases but I highly doubt someone will ever see them in a userspace app on CodinGame).
Besides, if that's really an issue, O2 would still be acceptable and doesn't have the reputation of having that problem.
(Note that here again, I'm not talking about bugs that exist and only show under O3. Those are the cause of bad coding and not flags, and should be fixed by the contestant.)
I find not having optimization flags so absurd that I didn't even think that was possible.
So far, I've been writing my code carefully flagging every const function as "const", without "inline" flags and letting the compiler do the optimization : its job.
It's a shame it didn't, for several reasons :
- When people code in C++ they expect it to do so. I would have coded differently (understand, in a tremendously ugly way for it to be faster) if I knew it didn't. And I wouldn't have enjoyed it.
- It would reduce server load, games would compute faster.
- It would allow for more clever IAs, more pleasant fights to watch in versus games.
- The fact C++ is faster than say Python for real world applications is also something REAL that it's good to teach to people.