bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Help with clang sanitizer


From: Akim Demaille
Subject: Help with clang sanitizer
Date: Fri, 21 Sep 2018 07:08:27 +0200

Hi all,

The CI is running the test suite with address sanitizer turned on.
There are two failing tests:

> 317. types.at:128: testing lalr1.cc api.value.type=variant ...
> ++ cat
> ++ test x = x1
> ++ set +x
> ./types.at:128: bison -fno-caret -o test.cc test.y
> ++ bison -fno-caret -o test.cc test.y
> ++ set +x
> ./types.at:128: $BISON_CXX_WORKS
> ++ :
> stderr:
> stdout:
> ++ set +x
> ./types.at:128: $CXX $CXXFLAGS $CPPFLAGS  $LDFLAGS -o test test.cc $LIBS
> ++ clang++-5.0 -fsanitize=address -g -O2 -Wall -Wextra -Wno-sign-compare 
> -Wcast-align -fparse-all-comments -Wdocumentation -Wformat -Wnull-dereference 
> -Wpointer-arith -Wwrite-strings -Wundef -pedantic -Wdeprecated -Wsign-compare 
> -fno-color-diagnostics -Wno-keyword-macro -Werror 
> -I/home/travis/build/akimd/bison/tests -I/home/travis/build/akimd/bison/lib 
> -I/home/travis/build/akimd/bison/lib -o test test.cc 
> /home/travis/build/akimd/bison/lib/libbison.a
> stderr:
> stdout:
> ++ set +x
> ./types.at:128:  $PREPARSER ./test
> ++ ./test
> stderr:
> =================================================================
> ==3989==ERROR: LeakSanitizer: detected memory leaks
> Direct leak of 28 byte(s) in 1 object(s) allocated from:
>     #0 0x527308 in operator new(unsigned long) 
> (/home/travis/build/akimd/bison/tests/testsuite.dir/317/test+0x527308)
>     #1 0x2b0a17ec6248 in std::string::_Rep::_S_create(unsigned long, unsigned 
> long, std::allocator<char> const&) 
> (/usr/lib/x86_64-linux-gnu/libstdc++.so.6+0xba248)
>     #2 0x724e58  (<unknown module>)
> SUMMARY: AddressSanitizer: 28 byte(s) leaked in 1 allocation(s).
> ./types.at:128: exit code was 1, expected 0
> 317. types.at:128: 317. lalr1.cc api.value.type=variant (types.at:128): 
> FAILED (types.at:128)
> #                             -*- compilation -*-
> 318. types.at:128: testing lalr1.cc api.value.type=variant %defines ...
> ++ cat
> ++ test x = x1
> ++ set +x
> ./types.at:128: bison -fno-caret -o test.cc test.y
> ++ bison -fno-caret -o test.cc test.y
> ++ set +x
> ./types.at:128: $BISON_CXX_WORKS
> ++ :
> stderr:
> stdout:
> ++ set +x
> ./types.at:128: $CXX $CXXFLAGS $CPPFLAGS  $LDFLAGS -o test test.cc $LIBS
> ++ clang++-5.0 -fsanitize=address -g -O2 -Wall -Wextra -Wno-sign-compare 
> -Wcast-align -fparse-all-comments -Wdocumentation -Wformat -Wnull-dereference 
> -Wpointer-arith -Wwrite-strings -Wundef -pedantic -Wdeprecated -Wsign-compare 
> -fno-color-diagnostics -Wno-keyword-macro -Werror 
> -I/home/travis/build/akimd/bison/tests -I/home/travis/build/akimd/bison/lib 
> -I/home/travis/build/akimd/bison/lib -o test test.cc 
> /home/travis/build/akimd/bison/lib/libbison.a
> stderr:
> stdout:
> ++ set +x
> ./types.at:128:  $PREPARSER ./test
> ++ ./test
> stderr:
> =================================================================
> ==3988==ERROR: LeakSanitizer: detected memory leaks
> Direct leak of 28 byte(s) in 1 object(s) allocated from:
>     #0 0x527308 in operator new(unsigned long) 
> (/home/travis/build/akimd/bison/tests/testsuite.dir/318/test+0x527308)
>     #1 0x2b3ee6e73248 in std::string::_Rep::_S_create(unsigned long, unsigned 
> long, std::allocator<char> const&) 
> (/usr/lib/x86_64-linux-gnu/libstdc++.so.6+0xba248)
>     #2 0x724e58  (<unknown module>)
> SUMMARY: AddressSanitizer: 28 byte(s) leaked in 1 allocation(s).
> ./types.at:128: exit code was 1, expected 0
> 318. types.at:128: 318. lalr1.cc api.value.type=variant %defines 
> (types.at:128): FAILED (types.at:128)

I have several problems.  First, I failed to have the error
‘symbolized’:

>     #0 0x527308 in operator new(unsigned long) 
> (/home/travis/build/akimd/bison/tests/testsuite.dir/318/test+0x527308)

here, I would like to see the file and line of the culprit,
instead of an address.  I did define this envvar:

export ASAN_SYMBOLIZER_PATH=/usr/lib/llvm-5.0/bin/llvm-symbolizer

but to no avail (and set -x above proves that -g is passed to the compiler).

Second, I do not understand whether the leak is real and due to a bug
in the Bison and/or in the test suite.  Unfortunately I’m not
running on GNU/Linux, and I fail to reproduce this elsewhere.
Even with Docker, I fail to reproduce this.

I have tried with Valgrind, and Valgrind saw nothing wrong.

So… If someone could have a deep look at this, that would be very
helpful.

There’s a branch here that focuses on this issue:

  https://github.com/akimd/bison/tree/asan

And the failure can be seen here:

  https://travis-ci.com/akimd/bison/builds/85514597

Thanks!


reply via email to

[Prev in Thread] Current Thread [Next in Thread]