Add 'fwrapv' compile option.
authorAditya Mandaleeka <adityam@microsoft.com>
Tue, 3 May 2016 23:49:58 +0000 (16:49 -0700)
committerAditya Mandaleeka <adityam@microsoft.com>
Wed, 4 May 2016 00:26:17 +0000 (17:26 -0700)
Commit migrated from https://github.com/dotnet/coreclr/commit/e67df67213d1b4730d5d2c803c681bc55f009792

src/coreclr/compileoptions.cmake

index 739b1a2..c410498 100644 (file)
@@ -7,6 +7,10 @@ if (CLR_CMAKE_PLATFORM_UNIX)
   #-fms-compatibility      Enable full Microsoft Visual C++ compatibility
   #-fms-extensions         Accept some non-standard constructs supported by the Microsoft compiler
 
+  # Make signed arithmetic overflow of addition, subtraction, and multiplication wrap around
+  # using twos-complement representation (this is normally undefined according to the C++ spec).
+  add_compile_options(-fwrapv)
+
   if(CLR_CMAKE_PLATFORM_DARWIN)
     # We cannot enable "stack-protector-strong" on OS X due to a bug in clang compiler (current version 7.0.2)
     add_compile_options(-fstack-protector)