On 02/16/2017 08:07 AM, Chuck Atkins wrote:
> That being said, I do think we should revisit the use of O3 by default
> given the safety issues surounding it.

The following is just my opinion:

In my experience if O3 fails it is a bug in the compiler, which should
be fixed and somebody has to find them first. Or a bug in the code being
built with O3, usually something subtle with undefined behavior.

Code bugs that happen to work sort-of correctly under O2 but not O3
aren't really safe. Future compiler versions often include changes that
break the code anyway.

I build a couple of production release C++ projects under several
versions of GCC (Linux releases since 2010). I use O3 and profiling
feedback, which, yes, does reveal some bugs, even up to segfaulting the
compiler, so I have special checks in the Makefile for a few of those
versions.

The thing that makes this safe to do is testing. If the code isn't
working correctly because of O3 I know it because it fails to pass its
tests.

I haven't looked but I would hope CMake has tests that are run against
the optimized code...
-- 
                Knowledge is Power -- Power Corrupts
                        Study Hard -- Be Evil
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to