Commit 0a60a85
committed
[CIR] Add crash test cases for CXXConstCastExpr l-value and SD_Automatic reference temporaries
This commit adds two minimal test cases to clang/test/CIR/crashes/ for
known NYI (not yet implemented) features that cause crashes during a
ClangIR-enabled LLVM self-build:
1. const-cast-expr-lvalue.cpp
- Tests CXXConstCastExpr l-value emission
- Triggers assertion at CIRGenExpr.cpp:2720
- Error: 'Use emitCastLValue below, remove me when adding testcase'
- Minimal reproducer: const_cast used as l-value in assignment
2. ref-temp-automatic.cpp
- Tests SD_Automatic storage duration for reference temporaries
- Triggers UNREACHABLE at CIRGenExpr.cpp:2356
- Error: 'SD_Automatic not implemented'
- Minimal reproducer: auto&& binding to temporary return value
Both test cases were identified from a ninja build of clang at
/tmp/clangbuild compiled with -fclangir. The build revealed multiple
unique crash patterns, and these two represent new failure modes not
previously documented in the crash test suite.
The tests are marked XFAIL and serve as regression tests for when
these features are implemented. They follow the existing conventions
in clang/test/CIR/crashes/ with proper RUN lines, error location
comments, and minimal reproducers.
Test Plan:
- Verified both tests trigger their respective crashes with -fclangir
- Tests pass as expected failures with llvm-lit:
build/Release/bin/llvm-lit -v clang/test/CIR/crashes/{const-cast-expr-lvalue,ref-temp-automatic}.cpp
Both show: XFAIL (expectedly failed)
- Tests follow existing crash test patterns and formatting
- Minimal reproducers are concise (<20 lines each)1 parent 62d85f3 commit 0a60a85
File tree
2 files changed
+26
-0
lines changed- clang/test/CIR/crashes
2 files changed
+26
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
0 commit comments