Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

Segfault when evaluating STL expression #38475

Open Quuxplusone opened 5 years ago

Quuxplusone commented 5 years ago
Bugzilla Link PR39500
Status NEW
Importance P enhancement
Reported by Louis Dionne (ldionne@apple.com)
Reported on 2018-10-30 08:06:31 -0700
Last modified on 2018-10-30 08:09:30 -0700
Version unspecified
Hardware PC All
CC ditaliano@apple.com, llvm-bugs@lists.llvm.org, syaghmour@gmail.com, yaghmour.shafik@gmail.com
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also

When evaluating some STL expression, lldb segfaults. This only seems to happen with a recent Clang and LLDB, which may be related to the removal of always_inline from libc++ shipped with recent Clangs.

This bug is a reduction of the STL-related failure that started happening in http://green.lab.llvm.org/green/job/lldb-cmake/11896.

Here's the reproduction (with Trunk Clang and LLDB):

#!/bin/sh

cat > t.cpp <<EOF
#include <cstdio>
#include <map>
#include <string>
int main() {
    std::string hello_world = "Hello World!";
    std::map<std::string, int> associative_array;
    associative_array[hello_world] = 1;
    associative_array.count(hello_world);
    std::printf("before returning....\n"); // Set break point at this line.
}
EOF

clang++ t.cpp -O0 -g
lldb a.out

Then, from within lldb:

breakpoint set -l 9
run
expr associative_array.count(hello_world)
expr associative_array.count(hello_world)

The evaluation works the first time around, but fails the second time around with a segfault.

Quuxplusone commented 5 years ago

Shafik is the best person to look at this.