Commit 6548f76c authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

[build] Disable strict-overflow check on gcc

This flag generates false positives, since gcc inlines functions and
propagates constants, and then applies the check.

Drive-by: Refactor the checks that triggered the error to avoid
explicit casts.

R=jochen@chromium.org, machenbach@chromium.org
BUG=v8:6341

Change-Id: I86aebf402cbd2502ef17622a000a5bb777fd4b43
Reviewed-on: https://chromium-review.googlesource.com/494474Reviewed-by: 's avatarMichael Achenbach <machenbach@chromium.org>
Reviewed-by: 's avatarJochen Eisinger <jochen@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#45096}
parent 00d1e2cf
...@@ -480,6 +480,15 @@ config("toolchain") { ...@@ -480,6 +480,15 @@ config("toolchain") {
"/wd4800", # Forcing value to bool. "/wd4800", # Forcing value to bool.
] ]
} }
if (!is_clang && !is_win) {
cflags += [
# Disable gcc warnings for optimizations based on the assumption that
# signed overflow does not occur. Generates false positives (see
# http://crbug.com/v8/6341).
"-Wno-strict-overflow",
]
}
} }
############################################################################### ###############################################################################
......
...@@ -780,6 +780,12 @@ ...@@ -780,6 +780,12 @@
# Don't warn about unrecognized command line option. # Don't warn about unrecognized command line option.
'-Wno-gnu-zero-variadic-macro-arguments', '-Wno-gnu-zero-variadic-macro-arguments',
], ],
'cflags' : [
# Disable gcc warnings for optimizations based on the assumption
# that signed overflow does not occur. Generates false positives
# (see http://crbug.com/v8/6341).
"-Wno-strict-overflow",
],
}], }],
[ 'clang==1 and (v8_target_arch=="x64" or v8_target_arch=="arm64" \ [ 'clang==1 and (v8_target_arch=="x64" or v8_target_arch=="arm64" \
or v8_target_arch=="mips64el")', { or v8_target_arch=="mips64el")', {
......
...@@ -34,9 +34,9 @@ class Vector { ...@@ -34,9 +34,9 @@ class Vector {
// Returns a vector using the same backing storage as this one, // Returns a vector using the same backing storage as this one,
// spanning from and including 'from', to but not including 'to'. // spanning from and including 'from', to but not including 'to'.
Vector<T> SubVector(int from, int to) const { Vector<T> SubVector(int from, int to) const {
DCHECK(0 <= from); DCHECK_LE(0, from);
SLOW_DCHECK(from <= to); DCHECK_LE(from, to);
SLOW_DCHECK(static_cast<unsigned>(to) <= static_cast<unsigned>(length_)); DCHECK_LE(to, length_);
return Vector<T>(start() + from, to - from); return Vector<T>(start() + from, to - from);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment