3 ms·
The results for that query all seem to say that "gcc -O4" doesn't exist. There is one proposal from Chris Lattner for adding this to Clang, but it's not clear
by haberman 11y ago
The results for that query all seem to say that "gcc -O4" doesn't exist. There is one proposal from Chris Lattner for adding this to Clang, but it's not clear that this ever happened.
- ktRolster 11y agoCurrently gcc uses -Ofast for 'dangerous' optimizations. Maybe I remembered the history wrong. There are definitely cases of people using -O4 http://www.larcenists.org/Twobit/KVW/kvwbenchmarks.html http://www.larcenists.org/Twobit/KVW/kvwbenchmarks.html . There are definitely optimization options which are (or have been) available that are not turned on by -O3. For example: -ffast-math -funroll-all-loops -fstrict-aliasing Are not turned on (for good reasons: unrolling loops often slows a program down). So there's no reason UB optimizations need to be turned on by default, or with -O3. You could throw them in -Ofast or use -Oub, or use optimization specific flags (they should have optimization specific flags in any case) and that was my main point.
- haberman 11y ago-Ofast turns on optimizations that can break standard-conforming programs! That is a very different thing that turning on optimizations that might break non-standard-conforming programs! I think the idea of making it controlled by optimization flags is interesting, but you would need to formalize what the more "safe" variant of the language is if people are actually going to depend on it.
- ktRolster 11y agoThat is a very different thing that turning on optimizations that might break non-standard-conforming programs! You're talking as though the standard were well-defined. It's not.