Add -ftrapv to debug builds.
This adds instrumentation to check that signed integers never under- or
overflow, which is undefined behavior.
BUG=skia:3096
Review URL: https://codereview.chromium.org/702893003
diff --git a/gyp/common_conditions.gypi b/gyp/common_conditions.gypi
index 059806f..1684151 100644
--- a/gyp/common_conditions.gypi
+++ b/gyp/common_conditions.gypi
@@ -414,6 +414,7 @@
'ldflags': ['--coverage'],
},
'Debug': {
+ 'cflags': ['-ftrapv'], # Crash on signed integer over/underflow.
},
'Release': {
'cflags': [
@@ -594,7 +595,7 @@
],
'configurations': {
'Debug': {
- 'cflags': ['-g']
+ 'cflags': ['-g', '-ftrapv']
},
'Release': {
'cflags': ['-O2'],