[llvm-bugs] [Bug 43262] New: clang crash on specific source code.

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Sep 10 01:15:14 PDT 2019


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

            Bug ID: 43262
           Summary: clang crash on specific source code.
           Product: clang
           Version: 7.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C
          Assignee: unassignedclangbugs at nondot.org
          Reporter: ouxianfei at smail.nju.edu.cn
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

I ever mistakenly wrote following code:

```
int main() {
  int result = 0;
  long long ll;

  asm volatile("" : "=a"(result), "=A"(ll));
  return result;
}
```

When I used clang-7 under ubuntu-18.04 to compile it, I got the stack dump as
below:

```
Stack dump:
0.      Program arguments: /usr/lib/llvm-7/bin/clang -cc1 -triple
x86_64-pc-linux-gnu -emit-obj -mrelax-all -disable-free -disable-llvm-verifier
-discard-value-names -main-file-name clang_bug_in_asm.c -mrelocation-model
static -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose
-mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64
-dwarf-column-info -debugger-tuning=gdb -resource-dir
/usr/lib/llvm-7/lib/clang/7.0.0 -internal-isystem /usr/local/include
-internal-isystem /usr/lib/llvm-7/lib/clang/7.0.0/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include
-fdebug-compilation-dir /home/wierton/wt_toy -ferror-limit 19 -fmessage-length
92 -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -o
/tmp/clang_bug_in_asm-dba45c.o -x c clang_bug_in_asm.c -faddrsig
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module 'clang_bug_in_asm.c'.
4.      Running pass 'Fast Register Allocator' on function '@main'
#0 0x00007f8677e18e8a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/lib/llvm-7/bin/../lib/libLLVM-7.so.1+0x908e8a)
#1 0x00007f8677e17544 llvm::sys::RunSignalHandlers()
(/usr/lib/llvm-7/bin/../lib/libLLVM-7.so.1+0x907544)
#2 0x00007f8677e17682 (/usr/lib/llvm-7/bin/../lib/libLLVM-7.so.1+0x907682)
#3 0x00007f867b3fa890 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
#4 0x00007f86781bcfbc (/usr/lib/llvm-7/bin/../lib/libLLVM-7.so.1+0xcacfbc)
#5 0x00007f86781bd5d3 (/usr/lib/llvm-7/bin/../lib/libLLVM-7.so.1+0xcad5d3)
#6 0x00007f86780e1d70 llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
(/usr/lib/llvm-7/bin/../lib/libLLVM-7.so.1+0xbd1d70)
#7 0x00007f8677f093a8 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/usr/lib/llvm-7/bin/../lib/libLLVM-7.so.1+0x9f93a8)
#8 0x00007f8677f093f3 llvm::FPPassManager::runOnModule(llvm::Module&)
(/usr/lib/llvm-7/bin/../lib/libLLVM-7.so.1+0x9f93f3)
#9 0x00007f8677f08a70 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/usr/lib/llvm-7/bin/../lib/libLLVM-7.so.1+0x9f8a70)
#10 0x0000557e480fd132 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/lib/llvm-7/bin/clang+0x4f0132)
#11 0x0000557e48710284 (/usr/lib/llvm-7/bin/clang+0xb03284)
#12 0x0000557e48daf0a9 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/lib/llvm-7/bin/clang+0x11a20a9)
#13 0x0000557e4870f407 clang::CodeGenAction::ExecuteAction()
(/usr/lib/llvm-7/bin/clang+0xb02407)
#14 0x0000557e48538926 clang::FrontendAction::Execute()
(/usr/lib/llvm-7/bin/clang+0x92b926)
#15 0x0000557e485004cc
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/lib/llvm-7/bin/clang+0x8f34cc)
#16 0x0000557e485eb90b
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/lib/llvm-7/bin/clang+0x9de90b)
#17 0x0000557e4809e688 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/lib/llvm-7/bin/clang+0x491688)
#18 0x0000557e4808d3fc main (/usr/lib/llvm-7/bin/clang+0x4803fc)
#19 0x00007f8676801b97 __libc_start_main
/build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:344:0
#20 0x0000557e4809be5a _start (/usr/lib/llvm-7/bin/clang+0x48ee5a)
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 7.0.0-3~ubuntu0.18.04.1 (tags/RELEASE_700/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
clang: note: diagnostic msg: PLEASE submit a bug report to
https://bugs.llvm.org/ and include the crash backtrace, preprocessed source,
and associated run script.
clang: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/clang_bug_in_asm-a71e29.c
clang: note: diagnostic msg: /tmp/clang_bug_in_asm-a71e29.sh
clang: note: diagnostic msg:

********************

```

-- 
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/20190910/d7ceae57/attachment-0001.html>


More information about the llvm-bugs mailing list