[LLVMbugs] [Bug 20530] New: Compiling with --coverage leads to a segmentation fault

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Aug 4 05:37:51 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=20530

            Bug ID: 20530
           Summary: Compiling with --coverage leads to a segmentation
                    fault
           Product: new-bugs
           Version: 3.4
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: chretien at lirmm.fr
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

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:
 * CMake
 * Git
 * Eigen >= 3.2
 * Boost
 * pkg-config
 * log4cxx
 * libtool

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)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140804/0b96c5c4/attachment.html>


More information about the llvm-bugs mailing list