Open llvmbot opened 10 years ago
I can confirm the same bug with clang version 3.5.0 (tags/RELEASE_350/final), when compiling our code (https://github.com/apache/celix):
Program received signal SIGSEGV, Segmentation fault. 0x00007ffff111d260 in ?? () (gdb) bt
The error can be reproduced by the following steps. Note that the vagrant cfg needs to be changed to use travis/travis as credentials.
$ vagrant init travis-ci/ci-minimal-trusty64 && vagrant up $ vagrant ssh
$ sudo apt-get -qq update && sudo apt-get install -y uuid-dev libjansson-dev libxml2-dev lcov libffi-dev cpputest
$ git clone --branch=develop https://github.com/apache/celix.git apache/celix && cd apache/celix && git reset --hard a50863d9f77392d6019dc7658f6f8a5d75f19193
$ mkdir -p build && cd build
$ export CC=clang CXX=clang++
$ cmake -DENABLE_TESTING=ON -DENABLE_CODE_COVERAGE=ON -DBUILD_REMOTE_SERVICE_ADMIN=ON -DBUILD_RSA_REMOTE_SERVICE_ADMIN_HTTP=ON ..
$ make
$ cd remote_services/remote_service_admin_http/private/test/ && ./test_rsa_http
Extended Description
When compiling one of our projects (https://github.com/roboptim/roboptim-core) with clang on Linux with the --coverage option, we end up with a segmentation fault at the end of some of the programs:
gdb output:
Program received signal SIGSEGV, Segmentation fault. => 0x7ffff7ee97b0: Error while running hook_stop: Cannot access memory at address 0x7ffff7ee97b0
0 0x00007ffff7ee97b0 in ?? ()
1 0x00007ffff7767a54 in llvm_writeout_files () from .../roboptim-core/build/src/libroboptim-core.so.2
2 0x00007ffff5a11c1f in __cxa_finalize () from /usr/lib/libc.so.6
3 0x00007ffff758edd3 in __do_global_dtors_aux () from /home/ben/dev/roboptim-core/build/src/libroboptim-core.so.2
4 0x00007fffffffe1e0 in ?? ()
5 0x00007ffff7deb657 in _dl_fini () from /lib64/ld-linux-x86-64.so.2
Backtrace stopped: frame did not save the PC
valgrind output:
Jump to the invalid address stated on the next line ==21273== at 0x40A0790: ??? ==21273== by 0x546AA53: llvm_writeout_files (in .../roboptim-core/build/src/libroboptim-core.so.2.0.0) ==21273== by 0x6EBCC1E: cxa_finalize (in /usr/lib/libc-2.19.so) ==21273== by 0x5291DD2: ??? (in .../roboptim-core/build/src/libroboptim-core.so.2.0.0) ==21273== by 0x400F656: _dl_fini (in /usr/lib/ld-2.19.so) ==21273== by 0x6EBC881: run_exit_handlers (in /usr/lib/libc-2.19.so) ==21273== by 0x6EBC8D4: exit (in /usr/lib/libc-2.19.so) ==21273== by 0x6EA6006: (below main) (in /usr/lib/libc-2.19.so) ==21273== Address 0x40a0790 is not stack'd, malloc'd or (recently) free'd ==21273== ==21273== ==21273== Process terminating with default action of signal 11 (SIGSEGV) ==21273== Access not within mapped region at address 0x40A0790 ==21273== at 0x40A0790: ??? ==21273== by 0x546AA53: llvm_writeout_files (in .../roboptim-core/build/src/libroboptim-core.so.2.0.0) ==21273== by 0x6EBCC1E: cxa_finalize (in /usr/lib/libc-2.19.so) ==21273== by 0x5291DD2: ??? (in .../roboptim-core/build/src/libroboptim-core.so.2.0.0) ==21273== by 0x400F656: _dl_fini (in /usr/lib/ld-2.19.so) ==21273== by 0x6EBC881: run_exit_handlers (in /usr/lib/libc-2.19.so) ==21273== by 0x6EBC8D4: exit (in /usr/lib/libc-2.19.so) ==21273== by 0x6EA6006: (below main) (in /usr/lib/libc-2.19.so)
Note that everything works perfectly with gcc on Linux, or even clang on OSX (at least the version used by the osx virtual machine on Travis), and everything works fine if we remove the --coverage option.
If you want to test our code:
Requirements:
Getting and running the code:
$ git clone --recursive https://github.com/roboptim/roboptim-core.git $ cd roboptim-core && mkdir build && cd build $ cmake .. -DCMAKE_CXX_FLAGS=--coverage -DCMAKE_EXE_LINKER_FLAGS=--coverage -DCMAKE_MODULE_LINKER_FLAGS=--coverage -DCMAKE_CXX_COMPILER=/usr/bin/clang++ -DCMAKE_C_COMPILER=/usr/bin/clang $ make $ make test
You should get (with clang + --coverage on Linux):
The following tests FAILED: 18 - solver-factory (SEGFAULT) 21 - example (SEGFAULT) 22 - plugin (SEGFAULT) 23 - plugin-laststate (SEGFAULT) 25 - optimization-logger (SEGFAULT) 26 - multiplexer (SEGFAULT)