0

GCC: no -fno-delete-null-pointer-checks in compiler flags

GCC seems to have a bug with constexpr when this flag is present:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97913

So enable it only on clang for now.

Bug: 1139129
Change-Id: If657d5e3fac1621adf57c266cfd64ce628dc7b86
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2551494
Commit-Queue: Matthew Denton <mpdenton@chromium.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#829585}
This commit is contained in:
Matthew Denton
2020-11-20 08:17:26 +00:00
committed by Commit Bot
parent ecb863065d
commit 023af6393c

@@ -263,7 +263,10 @@ config("compiler") {
# of some security-critical code: see https://crbug.com/1139129.
# Nacl does not support the flag. And, we still want UBSAN to catch undefined
# behavior related to nullptrs, so do not add this flag if UBSAN is enabled.
if (!is_nacl && !is_ubsan) {
# GCC seems to have some bugs compiling constexpr code when this is defined,
# so only enable it if using_clang. See: https://gcc.gnu.org/PR97913
# TODO(mpdenton): remove is_clang once GCC bug is fixed.
if (!is_nacl && !is_ubsan && is_clang) {
cflags += [ "-fno-delete-null-pointer-checks" ]
}