[llvm-bugs] [Bug 33964] New: Returning copy of heap allocated class in switch statement leads to crash

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jul 27 07:16:34 PDT 2017


https://bugs.llvm.org/show_bug.cgi?id=33964

            Bug ID: 33964
           Summary: Returning copy of heap allocated class in switch
                    statement leads to crash
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: drott at chromium.org
                CC: llvm-bugs at lists.llvm.org

Created attachment 18860
  --> https://bugs.llvm.org/attachment.cgi?id=18860&action=edit
FontStyleResolver-8a192c.cpp

Compiling the attached reduction using:
$ clang -cc1 -emit-obj -Oz -std=gnu++11  -x c++ FontStyleResolver-8a192c.cpp

$ clang  --version
clang version 5.0.0 (trunk 307486)

leads to the following stack trace, see below.

When turning NormalSlopeValue() and ItalicSlopeValue() into functions that
return static const FontSelectionValueStyle& instead of static const
FontSelectionValueStyle, the issue does not occur.


clang:
/b/build/slave/linux_upload_clang/build/src/third_party/llvm/lib/CodeGen/MachineBasicBlock.cpp:56:
llvm::MCSymbol *llvm::MachineBasicBlock::getSymbol() const: Assertion
`getNumber() >= 0 && "cannot get label for unreachable MBB"' failed.
#0 0x0000000001d59574
(/usr/local/google/home/drott/dev/blink/src/third_party/llvm-build/Release+Asserts/bin/clang+0x1d59574)
#1 0x0000000001d59896
(/usr/local/google/home/drott/dev/blink/src/third_party/llvm-build/Release+Asserts/bin/clang+0x1d59896)
#2 0x00007facf7efe330 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
#3 0x00007facf6aeec37 gsignal
/build/eglibc-SvCtMH/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#4 0x00007facf6af2028 abort
/build/eglibc-SvCtMH/eglibc-2.19/stdlib/abort.c:91:0
#5 0x00007facf6ae7bf6 __assert_fail_base
/build/eglibc-SvCtMH/eglibc-2.19/assert/assert.c:92:0
#6 0x00007facf6ae7ca2 (/lib/x86_64-linux-gnu/libc.so.6+0x2fca2)
#7 0x00000000015c8b25
(/usr/local/google/home/drott/dev/blink/src/third_party/llvm-build/Release+Asserts/bin/clang+0x15c8b25)
#8 0x0000000001196892
(/usr/local/google/home/drott/dev/blink/src/third_party/llvm-build/Release+Asserts/bin/clang+0x1196892)
#9 0x0000000001197e7c
(/usr/local/google/home/drott/dev/blink/src/third_party/llvm-build/Release+Asserts/bin/clang+0x1197e7c)
#10 0x0000000001194373
(/usr/local/google/home/drott/dev/blink/src/third_party/llvm-build/Release+Asserts/bin/clang+0x1194373)
#11 0x000000000237b788 llvm::AsmPrinter::EmitFunctionBody()
(/usr/local/google/home/drott/dev/blink/src/third_party/llvm-build/Release+Asserts/bin/clang+0x237b788)
#12 0x000000000118de70
(/usr/local/google/home/drott/dev/blink/src/third_party/llvm-build/Release+Asserts/bin/clang+0x118de70)
#13 0x00000000015fc0c4
llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
(/usr/local/google/home/drott/dev/blink/src/third_party/llvm-build/Release+Asserts/bin/clang+0x15fc0c4)
#14 0x00000000018d9ddf llvm::FPPassManager::runOnFunction(llvm::Function&)
(/usr/local/google/home/drott/dev/blink/src/third_party/llvm-build/Release+Asserts/bin/clang+0x18d9ddf)
#15 0x00000000018da033 llvm::FPPassManager::runOnModule(llvm::Module&)
(/usr/local/google/home/drott/dev/blink/src/third_party/llvm-build/Release+Asserts/bin/clang+0x18da033)
#16 0x00000000018da526 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/usr/local/google/home/drott/dev/blink/src/third_party/llvm-build/Release+Asserts/bin/clang+0x18da526)
#17 0x0000000001ed417f clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::HeaderSearchOptions const&, clang::CodeGenOptions const&,
clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout
const&, llvm::Module*, clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
(/usr/local/google/home/drott/dev/blink/src/third_party/llvm-build/Release+Asserts/bin/clang+0x1ed417f)
#18 0x00000000026057c2
(/usr/local/google/home/drott/dev/blink/src/third_party/llvm-build/Release+Asserts/bin/clang+0x26057c2)
#19 0x0000000002a6ff56 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/google/home/drott/dev/blink/src/third_party/llvm-build/Release+Asserts/bin/clang+0x2a6ff56)
#20 0x00000000022c3778 clang::FrontendAction::Execute()
(/usr/local/google/home/drott/dev/blink/src/third_party/llvm-build/Release+Asserts/bin/clang+0x22c3778)
#21 0x0000000002273f01
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/google/home/drott/dev/blink/src/third_party/llvm-build/Release+Asserts/bin/clang+0x2273f01)
#22 0x000000000234bb7a
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/google/home/drott/dev/blink/src/third_party/llvm-build/Release+Asserts/bin/clang+0x234bb7a)
#23 0x00000000008437d4 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*)
(/usr/local/google/home/drott/dev/blink/src/third_party/llvm-build/Release+Asserts/bin/clang+0x8437d4)
#24 0x000000000084138e main
(/usr/local/google/home/drott/dev/blink/src/third_party/llvm-build/Release+Asserts/bin/clang+0x84138e)
#25 0x00007facf6ad9f45 __libc_start_main
/build/eglibc-SvCtMH/eglibc-2.19/csu/libc-start.c:321:0
#26 0x000000000083e5f9 _start
(/usr/local/google/home/drott/dev/blink/src/third_party/llvm-build/Release+Asserts/bin/clang+0x83e5f9)
Stack dump:
0.      Program arguments:
/usr/local/google/home/drott/dev/blink/src/third_party/llvm-build/Release+Asserts/bin/clang
-cc1 -emit-obj -Oz -std=gnu++11 -x c++ FontStyleResolver-8a192c.cpp 
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module
'FontStyleResolver-8a192c.cpp'.
4.      Running pass 'X86 Assembly Printer' on function
'@_ZNK18CSSIdentifierValue9ConvertToI23FontSelectionValueStyleEET_v'
./FontStyleResolver-8a192c.sh: line 2: 22357 Aborted                 (core
dumped)
/usr/local/google/home/drott/dev/blink/src/third_party/llvm-build/Release+Asserts/bin/clang
-cc1 -emit-obj -Oz -std=gnu++11 -x c++ FontStyleResolver-8a192c.cpp

-- 
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/20170727/e448dc7f/attachment.html>


More information about the llvm-bugs mailing list