llvm / llvm/llvm-project

[clang][module] clang assertion on ``CheckPoint >= Buff->getBufferStart() && CheckPoint <= Buff->getBufferEnd()' ` when compile options are not configured

Open
#201,179 5 comments 0 reactions 0 assignees View on GitHub
clang:modules crash regression:21
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

```cxx
#pragma clang module build A
module A {}
#pragma clang module contents
#pragma clang module begin A
template auto f() { return []{}; }
#pragma clang module end
#pragma clang module endbuild

#pragma clang module build B
struct Outer {
struct Inner {
Inner() {}
Function f = []{};
};
Outer(Inner = Inner());
};

inline void use_nested_2() { Outer o; }
#pragma clang module end
#pragma clang module endbuild

inline auto q() { return []{}; }
inline auto x3() { return q(); }

#pragma clang module import B
#pragma clang module import C
using T = decltype(x1);
using T = decltype(y1);

using U = decltype(x2);
using U = decltype(y2);

using V = decltype(x3);
using V = decltype(y3);

#pragma clang module import A
void (*p)() = f();

void use_nested() {
use_nested_1();
use_nested_2();
}
```
https://godbolt.org/z/Poxq1zM5j
seem to be introduced since clang21.1.0, not reproducable in clang20.1.0
Occurs on both assert and non assert version, and it triggers two assertions at the same time.
It is a bit weird that whenever the C++ version is configured in compile option, even if in that version module is not supported, it doesn't crash,

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.