`cgeist` crashes when dealing with overloaded operators
- Dominant language
- LLVM
- Stars
- 1.5k
- Forks
- 854
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 137
Description
**Describe the bug**
Calling some overloaded operators in the code makes `cgeist` crash.
**To Reproduce**
```cpp
class bar {
public:
friend bar operator+(const bar &lhs, const bar &rhs);
};
bar add(const bar &lhs, const bar &rhs) {
return lhs + rhs;
}
```
```bash
./build/bin/cgeist %s -o - -S -function=*
```
Crashes with:
```
cgeist: DPCPP_DIR/polygeist/tools/cgeist/Lib/CGStmt.cc:1129: ValueCategory MLIRScanner::VisitReturnStmt(clang::ReturnStmt*): Assertion `rv.val && "expect right value to be valid"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: DPCPP_DIR/build/bin/cgeist /tmp/ola.cpp -o - -S -function=*
1. parser at end of file
#0 0x00007fcdbfb60d74 PrintStackTraceSignalHandler(void*) Signals.cpp:0:0
#1 0x00007fcdbfb5e534 SignalHandler(int) Signals.cpp:0:0
#2 0x00007fcdbf586090 (/lib/x86_64-linux-gnu/libc.so.6+0x43090)
#3 0x00007fcdbf58600b raise /build/glibc-SzIz7B/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
#4 0x00007fcdbf565859 abort /build/glibc-SzIz7B/glibc-2.31/stdlib/abort.c:81:7
#5 0x00007fcdbf565729 get_sysdep_segment_value /build/glibc-SzIz7B/glibc-2.31/intl/loadmsgcat.c:509:8
#6 0x00007fcdbf565729 _nl_load_domain /build/glibc-SzIz7B/glibc-2.31/intl/loadmsgcat.c:970:34
#7 0x00007fcdbf576fd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
#8 0x000056301631a997 MLIRScanner::VisitReturnStmt(clang::ReturnStmt*) (DPCPP_DIR/build/bin/cgeist+0xce997)
#9 0x00005630163190e4 MLIRScanner::VisitCompoundStmt(clang::CompoundStmt*) (DPCPP_DIR/build/bin/cgeist+0xcd0e4)
#10 0x00005630162bbaab MLIRScanner::init(mlir::FunctionOpInterface, FunctionToEmit const&) (DPCPP_DIR/build/bin/cgeist+0x6faab)
#11 0x00005630162bd592 MLIRASTConsumer::run() (DPCPP_DIR/build/bin/cgeist+0x71592)
#12 0x00007fcdbd50dc55 clang::ParseAST(clang::Sema&, bool, bool) (DPCPP_DIR/build/bin/../lib/../lib/libclangParse.so.16git+0x39c55)
#13 0x00007fcdc2ff8059 clang::FrontendAction::Execute() (DPCPP_DIR/build/bin/../lib/libclangFrontend.so.16git+0x152059)
#14 0x00005630162a8598 parseMLIR(char const*, std::vector, std::allocator >, std::allocator, std::allocator > > >, std::__cxx11::basic_string, std::allocator >, std::vector, std::allocator >, std::allocator, std::allocator > > >, std::vector, std::allocator >, std::allocator, std::allocator > > >, mlir::OwningOpRef&, llvm::Triple&, llvm::DataLayout&, std::vector, std::allocator >, std::allocator, std::allocator > > >) driver.cc:0:0
#15 0x000056301627d815 main (DPCPP_DIR/build/bin/cgeist+0x31815)
#16 0x00007fcdbf567083 __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:342:3
#17 0x000056301627f74e _start (DPCPP_DIR/build/bin/cgeist+0x3374e)
aborted (core dumped)
```
**Environment (please complete the following information):**
- OS: Linux
- Target device and vendor: Intel CPU
- DPC++ version: e6349c699222
Contributor guide
Assessment
This issue has not been assessed yet.