[Bug c++/87457] thread sanitizer false positive on virtual destructor

2018-10-10 Thread SebastiansPublicAddress at googlemail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87457

--- Comment #3 from SebastiansPublicAddress at googlemail dot com ---
Is there something else, which libstdc++ depends on, that I need to build with
ThreadSanitizer? libgcc or libatomic for example?

[Bug c++/87457] thread sanitizer false positive on virtual destructor

2018-10-10 Thread SebastiansPublicAddress at googlemail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87457

--- Comment #2 from SebastiansPublicAddress at googlemail dot com ---
(In reply to Jonathan Wakely from comment #1)
> I think the problem is that the std::thread code in libstdc++.so isn't built
> with ThreadSanitizer.

Wasn't easy to build libstdc++ with different flags (*), but now I think I did
it, and I still get the errors. So I think this was not the cause.

I'm quite sure that now I'm using a libstdc++ that's built with
-fsanitize=thread because:
- I added a printf to thread::join() and I see it when I reproduce the failure.
- I see -fsanitize=thread in the output of "make" when I build libstdc++.


(*) here's how I built libstdc++:
- Build the whole gcc-8 debian source package
  $ sudo apt-get build-dep gcc-8
  $ sudo apt-get source gcc-8
  gcc-8-8.2.0$ debuild -b -uc -us
- backup and remove gcc-8-8.2.0/build/x86_64-linux-gnu/libstdc++-v3
- configure with the same commandline as in the backup
  gcc-8-8.2.0/build/x86_64-linux-gnu/libstdc++-v3/config.log
  (fix quoting of --program-transform-name=s&$&-8&;s&^_64-linux-gnu-&)
  but with prefix /usr/local/tsan
- set a few environment variables as suggested by the error messages
  repeat until build is sucessful
- add --enable-cxx-flags=-fsanitize=thread
- make, make install
- export LD_LIBRARY_PATH=/usr/local/tsan/lib
- build my test program with -L/usr/local/tsan/lib -I/usr/local/tsan/include
- export LD_LIBRARY_PATH=/usr/local/tsan/lib

[Bug c++/87457] New: thread sanitizer false positive on virtual destructor

2018-09-27 Thread SebastiansPublicAddress at googlemail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87457

Bug ID: 87457
   Summary: thread sanitizer false positive on virtual destructor
   Product: gcc
   Version: 8.2.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: SebastiansPublicAddress at googlemail dot com
  Target Milestone: ---

Created attachment 44759
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44759=edit
source code to reproduce the bug

reproduce like this:

$ g++ -g -fno-omit-frame-pointer -fsanitize=undefined -fsanitize=thread -o
tsan_reproduce tsan_reproduce.cpp

$ ./tsan_reproduce
==
WARNING: ThreadSanitizer: data race (pid=19509)
  Write of size 8 at 0x7b040800 by thread T2:
#0 pipe  (libtsan.so.0+0x2f079)
#1   (libubsan.so.1+0x1aaed)
#2 void std::__invoke_impl(std::__invoke_other, void
(*&&)()) /usr/include/c++/8/bits/invoke.h:60 (tsan_reproduce+0x3efc)
#3 std::__invoke_result::type std::__invoke(void
(*&&)()) /usr/include/c++/8/bits/invoke.h:95 (tsan_reproduce+0x38e4)
#4 decltype (__invoke((_S_declval<0ul>)()))
std::thread::_Invoker
>::_M_invoke<0ul>(std::_Index_tuple<0ul>) /usr/include/c++/8/thread:244
(tsan_reproduce+0x569f)
#5 std::thread::_Invoker >::operator()()
/usr/include/c++/8/thread:253 (tsan_reproduce+0x55b7)
#6 std::thread::_State_impl >
>::_M_run() /usr/include/c++/8/thread:196 (tsan_reproduce+0x554c)
#7   (libstdc++.so.6+0xbbafe)

  Previous write of size 8 at 0x7b040800 by thread T1:
#0 pipe  (libtsan.so.0+0x2f079)
#1   (libubsan.so.1+0x1aaed)
#2 std::thread::_State_impl >
>::~_State_impl() /usr/include/c++/8/thread:188 (tsan_reproduce+0x54a3)
#3   (libstdc++.so.6+0xbbb07)

  Thread T2 (tid=19512, running) created by main thread at:
#0 pthread_create  (libtsan.so.0+0x2be2b)
#1 std::thread::_M_start_thread(std::unique_ptr >, void (*)()) 
(libstdc++.so.6+0xbbd84)
#2 main
/home/sebastian/projects/photoalbum/lib/sqdbcpp/tsan_reproduce.cpp:18
(tsan_reproduce+0x346f)

  Thread T1 (tid=19511, finished) created by main thread at:
#0 pthread_create  (libtsan.so.0+0x2be2b)
#1 std::thread::_M_start_thread(std::unique_ptr >, void (*)()) 
(libstdc++.so.6+0xbbd84)
#2 main
/home/sebastian/projects/photoalbum/lib/sqdbcpp/tsan_reproduce.cpp:17
(tsan_reproduce+0x345c)

SUMMARY: ThreadSanitizer: data race
(/usr/lib/x86_64-linux-gnu/libtsan.so.0+0x2f079) in pipe
==
ThreadSanitizer: reported 1 warnings




My system:

$ uname -a
Linux roc-lin 4.18.0-1-amd64 #1 SMP Debian 4.18.8-1 (2018-09-18) x86_64
GNU/Linux

$ g++ --version
g++ (Debian 8.2.0-7) 8.2.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[Bug c++/58161] New: internal compiler error while compiling SemaDeclCXX.cpp

2013-08-14 Thread SebastiansPublicAddress at googlemail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58161

Bug ID: 58161
   Summary: internal compiler error while compiling
SemaDeclCXX.cpp
   Product: gcc
   Version: 4.7.2
Status: UNCONFIRMED
  Severity: blocker
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: SebastiansPublicAddress at googlemail dot com

I'm compiling on a raspberry pi (no cross compiling), so this may be caused by
insufficient memory. But gcc doesn't say so. It just says

g++-4.7: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See file:///usr/share/doc/gcc-4.7/README.Bugs for instructions.

The full commandline:

g++-4.7 -I/home/pi/projects/llvm/llvm-3.3.build/include
-I/home/pi/projects/llvm/llvm-3.3.build/tools/clang/lib/Sema
-I/home/pi/projects/llvm/llvm-3.3.src/include
-I/home/pi/projects/llvm/llvm-3.3.src/tools/clang/lib/Sema  -D_DEBUG
-D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS
-D__STDC_LIMIT_MACROS
-I/home/pi/projects/llvm/llvm-3.3.src/tools/clang/lib/Sema/../../include
-I/home/pi/projects/llvm/llvm-3.3.build/tools/clang/lib/Sema/../../include -O3
-fomit-frame-pointer -fvisibility-inlines-hidden -fno-exceptions -fno-rtti
-fPIC -Woverloaded-virtual -Wcast-qual -fno-strict-aliasing-pedantic
-Wno-long-long -Wall -W -Wno-unused-parameter -Wwrite-strings   
-Wno-maybe-uninitialized -Wno-missing-field-initializers -c -MMD -MP -MF
/home/pi/projects/llvm/llvm-3.3.build/tools/clang/lib/Sema/Release+Asserts/SemaDeclCXX.d.tmp
-MT
/home/pi/projects/llvm/llvm-3.3.build/tools/clang/lib/Sema/Release+Asserts/SemaDeclCXX.o
-MT
/home/pi/projects/llvm/llvm-3.3.build/tools/clang/lib/Sema/Release+Asserts/SemaDeclCXX.d
/home/pi/projects/llvm/llvm-3.3.src/tools/clang/lib/Sema/SemaDeclCXX.cpp -o
/home/pi/projects/llvm/llvm-3.3.build/tools/clang/lib/Sema/Release+Asserts/SemaDeclCXX.o

$ g++-4.7 -v
Using built-in specs.
COLLECT_GCC=g++-4.7
COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabihf/4.7/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: ../src/configure -v --with-pkgversion='Debian 4.7.2-5+rpi1'
--with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs
--enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.7 --enable-shared --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object
--disable-libitm --enable-plugin --enable-objc-gc --disable-sjlj-exceptions
--with-arch=armv6 --with-fpu=vfp --with-float=hard --enable-checking=release
--build=arm-linux-gnueabihf --host=arm-linux-gnueabihf
--target=arm-linux-gnueabihf
Thread model: posix
gcc version 4.7.2 (Debian 4.7.2-5+rpi1)


[Bug c++/58161] internal compiler error while compiling SemaDeclCXX.cpp

2013-08-14 Thread SebastiansPublicAddress at googlemail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58161

--- Comment #1 from SebastiansPublicAddress at googlemail dot com ---
Created attachment 30658
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=30658action=edit
preprocessed file compressed because of file size limit