Bug#665499: clang: code using std::stack crashes with SIGILL when compiled with clang++

Robert Luberda robert at debian.org
Sat Mar 24 18:23:19 UTC 2012


Package: clang
Version: 3.0-6
Severity: normal

The following simple C++ program crashes if compiled with clang++
(and, obviously, doesn't crash when compiled with g++)

   [20]/tmp> cat test.cpp
   #include <stack>
   
   int main()
   {
           std::stack<int> x;
   }

   [21]/tmp> clang++ -ggdb  test.cpp -o testcrash
   [22]/tmp> ./testcrash
   Illegal instruction (core dumped)


Gdb output:   
   [23]/tmp> gdb ./testcrash
   GNU gdb (GDB) 7.4-debian
   Copyright (C) 2012 Free Software Foundation, Inc.
   License GPLv3+: GNU GPL version 3 or later
   <http://gnu.org/licenses/gpl.html>
   This is free software: you are free to change and redistribute it.
   There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
   and "show warranty" for details.
   This GDB was configured as "i486-linux-gnu".
   For bug reporting instructions, please see:
   <http://www.gnu.org/software/gdb/bugs/>...
   Reading symbols from /tmp/testcrash...done.
   (gdb) r
   Starting program: /tmp/testcrash
   
   Program received signal SIGILL, Illegal instruction.
   0x0804889a in std::deque<int, std::allocator<int> >::deque
   (this=0xbffff768, __x=...)
       at /usr/include/c++/4.6/bits/stl_deque.h:834
   834                                         _M_get_Tp_allocator()); }
   (gdb) bt
   #0  0x0804889a in std::deque<int, std::allocator<int> >::deque
   (this=0xbffff768, __x=...)
       at /usr/include/c++/4.6/bits/stl_deque.h:834
   #1  0x080487e4 in std::deque<int, std::allocator<int> >::deque
   (this=0xbffff768, __x=...)
       at /usr/include/c++/4.6/bits/stl_deque.h:834
   #2  0x080487b4 in std::stack<int, std::deque<int, std::allocator<int> >
   >::stack (this=0xbffff768,
       __c=...) at /usr/include/c++/4.6/bits/stl_stack.h:130
   #3  0x08048724 in std::stack<int, std::deque<int, std::allocator<int> >
   >::stack (this=0xbffff768,
       __c=...) at /usr/include/c++/4.6/bits/stl_stack.h:130
   #4  0x08048691 in main () at test.cpp:5
   
   
Clang++ -v output:   
   
   [24]/tmp> clang++ -ggdb -v test.cpp -o testcrash
   Debian clang version 3.0-6 (tags/RELEASE_30/final) (based on LLVM 3.0)
   Target: i386-pc-linux-gnu
   Thread model: posix
    "/usr/bin/clang" -cc1 -triple i386-pc-linux-gnu -emit-obj -mrelax-all
   -disable-free -disable-llvm-verifier -main-file-name test.cpp
   -mrelocation-model static -mdisable-fp-elim -masm-verbose
   -mconstructor-aliases -target-cpu pentium4 -target-linker-version 2.22
   -momit-leaf-frame-pointer -v -g -resource-dir /usr/bin/../lib/clang/3.0
   -fmodule-cache-path /tmp/user/1000/clang-module-cache -internal-isystem
   /usr/include/c++/4.6 -internal-isystem
   /usr/include/c++/4.6/i486-linux-gnu -internal-isystem
   /usr/include/c++/4.6/backward -internal-isystem /usr/local/include
   -internal-isystem /usr/bin/../lib/clang/3.0/include
   -internal-externc-isystem /usr/include/i486-linux-gnu
   -internal-externc-isystem /usr/include -fdeprecated-macro -ferror-limit
   19 -fmessage-length 106 -fgnu-runtime -fobjc-runtime-has-arc
   -fobjc-runtime-has-weak -fobjc-fragile-abi -fcxx-exceptions -fexceptions
   -fdiagnostics-show-option -fcolor-diagnostics -o
   /tmp/user/1000/test-0idUdN.o -x c++ test.cpp
   clang -cc1 version 3.0 based upon llvm 3.0 hosted on i386-pc-linux-gnu
   ignoring nonexistent directory "/usr/bin/../lib/clang/3.0/include"
   ignoring nonexistent directory "/usr/include/i486-linux-gnu"
   ignoring nonexistent directory "/usr/include/c++/4.6//i486-linux-gnu/32"
   ignoring nonexistent directory "/usr/include/i486-linux-gnu/"
   ignoring nonexistent directory "/usr/bin/../lib/clang/3.0/include"
   ignoring nonexistent directory "/usr/include/i486-linux-gnu"
   ignoring duplicate directory "/usr/include/c++/4.6"
   ignoring duplicate directory "/usr/include/c++/4.6/i486-linux-gnu"
   ignoring duplicate directory "/usr/include/c++/4.6/backward"
   ignoring duplicate directory "/usr/include/c++/4.6"
   ignoring duplicate directory "/usr/include/c++/4.6/backward"
   ignoring duplicate directory "/usr/include/c++/4.6"
   ignoring duplicate directory "/usr/include/c++/4.6/i486-linux-gnu"
   ignoring duplicate directory "/usr/include/c++/4.6/backward"
   ignoring duplicate directory "/usr/local/include"
   ignoring duplicate directory "/usr/include"
   #include "..." search starts here:
   #include <...> search starts here:
    /usr/include/c++/4.6
    /usr/include/c++/4.6/i486-linux-gnu
    /usr/include/c++/4.6/backward
    /usr/local/include
    /usr/include
    /usr/include/i386-linux-gnu/
    /usr/include/clang/3.0/include/
    /usr/lib/gcc/i486-linux-gnu/4.6/include/
    /usr/lib/gcc/i486-linux-gnu/4.6/include-fixed/
   End of search list.
    "/usr/bin/ld" --hash-style=gnu --no-add-needed --eh-frame-hdr -m
   elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o testcrash
   /usr/lib/gcc/i486-linux-gnu/4.6/../../../i386-linux-gnu/crt1.o
   /usr/lib/gcc/i486-linux-gnu/4.6/../../../i386-linux-gnu/crti.o
   /usr/lib/gcc/i486-linux-gnu/4.6/crtbegin.o
   -L/usr/lib/gcc/i486-linux-gnu/4.6
   -L/usr/lib/gcc/i486-linux-gnu/4.6/../../../i386-linux-gnu
   -L/lib/i386-linux-gnu -L/usr/lib/i386-linux-gnu
   -L/usr/lib/gcc/i486-linux-gnu/4.6/../../../i386-linux-gnu
   -L/usr/lib/gcc/i486-linux-gnu/4.6/../../.. -L/lib/i386-linux-gnu -L/lib
   -L/usr/lib/i386-linux-gnu -L/usr/lib /tmp/user/1000/test-0idUdN.o
   -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc
   /usr/lib/gcc/i486-linux-gnu/4.6/crtend.o
   /usr/lib/gcc/i486-linux-gnu/4.6/../../../i386-linux-gnu/crtn.o

Regards,
robert

-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (990, 'unstable'), (200, 'testing')
Architecture: i386 (i686)

Kernel: Linux 3.2.0-1-686-pae (SMP w/1 CPU core)
Locale: LANG=pl_PL, LC_CTYPE=pl_PL (charmap=ISO-8859-2)
Shell: /bin/sh linked to /bin/dash

Versions of packages clang depends on:
ii  libc6                2.13-27
ii  libclang-common-dev  3.0-6
ii  libffi5              3.0.10-3
ii  libgcc1              1:4.7.0-1
ii  libllvm3.0           3.0-8
ii  libstdc++6           4.7.0-1
ii  libstdc++6-4.6-dev   4.6.3-1

Versions of packages clang recommends:
ii  llvm-3.0-dev  <none>
ii  python        2.7.2-10

clang suggests no packages.

-- no debconf information





More information about the Pkg-llvm-team mailing list