Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

configure: disable ASAN for buggy clang. #7158

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 24 additions & 5 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -294,18 +294,37 @@ done
# Now fill in any unset vars.
set_defaults

# We assume warning flags don't affect congfigurator that much!
echo -n "Compiling $CONFIGURATOR..."
$CC ${CWARNFLAGS-$BASE_WARNFLAGS} $CDEBUGFLAGS $COPTFLAGS -o $CONFIGURATOR $CONFIGURATOR.c
echo "done"

if [ "$ASAN" = "1" ]; then
if [ "$VALGRIND" = "1" ]; then
echo "Address sanitizer (ASAN) and valgrind cannot be enabled at the same time"
exit 1
fi

# Test for buggy clang https://github.com/llvm/llvm-project/issues/81470
cat > /tmp/asan-test.$$.c <<EOF
int main(int argc, char *argv[]) {
(void)argc;
(void)argv;
return __builtin_choose_expr(1, 0, "garbage");}
EOF
$CC $CSANFLAGS $CDEBUGFLAGS $COPTFLAGS -o /tmp/asan-test.$$ /tmp/asan-test.$$.c
# I get 219/1000 failures :(
for i in `seq 100`; do
if ! /tmp/asan-test.$$ 2>/dev/null; then
echo "WARNING: ASAN compilatin bug detected: DISABLING" >&2
CSANFLAGS=$(echo "$CSANFLAGS" | sed 's/-fsanitize=address//')
ASAN=0
break
fi
done
fi


# We assume warning flags don't affect congfigurator that much!
echo -n "Compiling $CONFIGURATOR..."
$CC ${CWARNFLAGS-$BASE_WARNFLAGS} $CDEBUGFLAGS $COPTFLAGS -o $CONFIGURATOR $CONFIGURATOR.c
echo "done"

if [ "$CLANG_COVERAGE" = "1" ]; then
case "$CC" in
(*"clang"*)
Expand Down
Loading