[llvm-bugs] [Bug 50970] New: Clang asserts when compiling OpenMP offloading with -Xclang -print-stats

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jul 2 09:27:33 PDT 2021


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

            Bug ID: 50970
           Summary: Clang asserts when compiling OpenMP offloading with
                    -Xclang -print-stats
           Product: OpenMP
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Clang Compiler Support
          Assignee: unassignedclangbugs at nondot.org
          Reporter: cchen at cray.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 24997
  --> https://bugs.llvm.org/attachment.cgi?id=24997&action=edit
A very simple OpenMP offloading sample code.

When compiling OpenMP offload code with `-fopenmp-targets` and `-print-stats`,
we got an assertion failure:

clang++ -fopenmp -fopenmp-targets=amdgcn-amd-amdhsa hello_gpu.c -Xclang
-print-stats

```
clang-13:
/ptmp/cchen/llvm-project/clang/include/clang/Frontend/CompilerInstance.h:442:
clang::Preprocessor& clang::CompilerInstance::getPreprocessor() const:
Assertion `PP && "Compiler instance has no preprocessor!"' failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash
backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: /cray/css/users/cchen/myllvm/bin/clang-13 -cc1
-triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all --mrelax-relocations
-disable-free -main-file-name a.out-wrapper -mrelocation-model static
-mframe-pointer=all -fmath-errno -fno-rounding-math -mconstructor-aliases
-munwind-tables -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb
-fcoverage-compilation-dir=/home/users/cchen -resource-dir
/cray/css/users/cchen/myllvm/lib/clang/13.0.0
-fdebug-compilation-dir=/home/users/cchen -ferror-limit 19 -fopenmp
-fgnuc-version=4.2.1 -fcolor-diagnostics -print-stats
-fopenmp-targets=amdgcn-amd-amdhsa -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o
/tmp/a-406030.o -x ir /tmp/a-a041f3.bc
 #0 0x0000000002ffc5ec llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
/ptmp/cchen/llvm-project/llvm/lib/Support/Unix/Signals.inc:569:3
 #1 0x0000000002ffa614 llvm::sys::RunSignalHandlers()
/ptmp/cchen/llvm-project/llvm/lib/Support/Signals.cpp:76:20
 #2 0x0000000002ffacbd SignalHandler(int)
/ptmp/cchen/llvm-project/llvm/lib/Support/Unix/Signals.inc:407:1
 #3 0x00007fcbfee702d0 __restore_rt (/lib64/libpthread.so.0+0x132d0)
 #4 0x00007fcbfdbe0520 raise (/lib64/libc.so.6+0x39520)
 #5 0x00007fcbfdbe1b01 abort (/lib64/libc.so.6+0x3ab01)
 #6 0x00007fcbfdbd8b1a __assert_fail_base (/lib64/libc.so.6+0x31b1a)
 #7 0x00007fcbfdbd8b92 (/lib64/libc.so.6+0x31b92)
 #8 0x000000000389f83c clang::CompilerInstance::getSourceManager() const
/ptmp/cchen/llvm-project/clang/include/clang/Frontend/CompilerInstance.h:422:5
 #9 0x000000000389f83c clang::FrontendAction::EndSourceFile()
/ptmp/cchen/llvm-project/clang/lib/Frontend/FrontendAction.cpp:1005:25
#10 0x000000000384190f
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
/ptmp/cchen/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:967:57
#11 0x000000000395d768
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
/ptmp/cchen/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:278:38
#12 0x0000000000d77372 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) /ptmp/cchen/llvm-project/clang/tools/driver/cc1_main.cpp:246:40
#13 0x0000000000d72ef7 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
/ptmp/cchen/llvm-project/clang/tools/driver/driver.cpp:343:34
#14 0x0000000000cb8359 main
/ptmp/cchen/llvm-project/clang/tools/driver/driver.cpp:415:26
#15 0x00007fcbfdbcb34a __libc_start_main (/lib64/libc.so.6+0x2434a)
#16 0x0000000000d71faa _start
/home/abuild/rpmbuild/BUILD/glibc-2.26/csu/../sysdeps/x86_64/start.S:122:0
clang-13: error: unable to execute command: Aborted (core dumped)
```

Upstream Clang do not asserts if not compiling device code:
clang++ -fopenmp hello_gpu.c -Xclang -print-stats

-- 
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/20210702/f53a1476/attachment.html>


More information about the llvm-bugs mailing list