Skip to content

Commit

Permalink
configure: disable ASAN for buggy clang.
Browse files Browse the repository at this point in the history
See llvm/llvm-project#81470 which started
breaking CI because configurator doesn't expect test programs to crash!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
  • Loading branch information
rustyrussell committed Mar 18, 2024
1 parent f39d2ee commit df0f4c4
Showing 1 changed file with 24 additions and 5 deletions.
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

0 comments on commit df0f4c4

Please sign in to comment.