Commit 6326786c authored by Ian Lance Taylor's avatar Ian Lance Taylor

misc/cgo/testsanitizers: fix test of whether compiler option works

On older versions of GCC we need to pass a file name before GCC will
report an unrecognized option.

Fixes #13065.

Change-Id: I7ed34c01a006966a446059025f7d10235c649072
Reviewed-on: https://go-review.googlesource.com/16589
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarDavid Crawshaw <crawshaw@golang.org>
parent ee0305e0
......@@ -15,10 +15,14 @@ if test "$(type -p clang)" != ""; then
fi
export CC
if $CC -fsanitize=memory 2>&1 | grep "unrecognized" >& /dev/null; then
TMPDIR=${TMPDIR:-/tmp}
echo > ${TMPDIR}/testsanitizers$$.c
if $CC -fsanitize=memory -c ${TMPDIR}/testsanitizers$$.c 2>&1 | grep "unrecognized" >& /dev/null; then
echo "skipping msan test: -fsanitize=memory not supported"
rm -f ${TMPDIR}/testsanitizers$$.*
exit 0
fi
rm -f ${TMPDIR}/testsanitizers$$.*
# The memory sanitizer in versions of clang before 3.6 don't work with Go.
if $CC --version | grep clang >& /dev/null; then
......
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