| Issue |
87139
|
| Summary |
[Clang] [Modules] Crash on `#include_next` in module with `-fimplicit-modules -fimplicit-module-map` in file w/ `.ccm` extension
|
| Labels |
clang:modules,
crash
|
| Assignees |
|
| Reporter |
Sirraide
|
This asserts on main with `-std=c++20 -fimplicit-modules -fimplicit-module-map` if the file ends with `.ccm`:
```c++
module;
#include <cstdint>
export module foo;
```
The stack trace points to line 124 of `stdint.h` (our `stdint.h`, that is), which is suspicious because lines 123–125 happen to be:
```
123 │ #if __has_include_next(<stdint.h>)
124 │ # include_next <stdint.h>
125 │ #endif
```
If the file ends with `.cc` instead of `.ccm`, it doesn’t crash.
Assertion:
```
clang-19: /home/ae/projects/Source-MLIR/llvm/clang/lib/Sema/SemaModule.cpp:751:
void clang::Sema::BuildModuleInclude(SourceLocation, Module *):
Assertion `ThisModule && "was expecting a module if building one"' failed
```
There isn’t much of a stack trace unfortunately:
```
0. Program arguments: /home/ae/projects/Source-MLIR/llvm/out/bin/clang-19 -cc1 -triple x86_64-unknown-linux-gnu -emit-module-interface -dumpdir a- -disable-free -clear-ast-before-backend -main-file-name test.ccm -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/tmp -fcoverage-compilation-dir=/tmp -resource-dir /home/ae/projects/Source-MLIR/llvm/out/lib/clang/19 -internal-isystem /home/ae/projects/Source-MLIR/llvm/out/bin/../include/x86_64-unknown-linux-gnu/c++/v1 -internal-isystem /home/ae/projects/Source-MLIR/llvm/out/bin/../include/c++/v1 -internal-isystem /home/ae/projects/Source-MLIR/llvm/out/lib/clang/19/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-redhat-linux/13/../../../../x86_64-redhat-linux/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -std=c++20 -fdeprecated-macro -ferror-limit 19 -fgnuc-version=4.2.1 -fmodules-cache-path=/home/ae/.cache/clang/ModuleCache -fmodule-map-file=/home/ae/projects/Source-MLIR/llvm/out/lib/clang/19/include/module.modulemap -fskip-odr-check-in-gmf -fcxx-exceptions -fexceptions -fcolor-diagnostics -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/test-6930d3.pcm -x c++ test.ccm
1. /home/ae/projects/Source-MLIR/llvm/out/bin/../include/c++/v1/stdint.h:124:1: at annotation token
#0 0x00000000036687e8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/ae/projects/Source-MLIR/llvm/out/bin/clang-19+0x36687e8)
clang++: error: unable to execute command: Aborted (core dumped)
clang++: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 19.0.0git
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/ae/projects/Source-MLIR/llvm/out/bin
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs