| Issue |
243381
|
| Summary |
[clang][DebugInfo] "Region stack mismatch, stack empty!" assert for alias to a static local with nodebug
|
| Labels |
clang
|
| Assignees |
|
| Reporter |
pvelesko
|
An alias to a function-local static whose debug info is suppressed with `nodebug` makes clang abort with `-g`:
```cpp
__attribute__((nodebug)) void f() { static int s; }
extern int a __attribute__((alias("_ZZ1fvE1s")));
```
```
$ clang -g -c -x c++ t.cpp
clang: clang/lib/CodeGen/CGDebugInfo.cpp:4734: void clang::CodeGen::CGDebugInfo::collectVarDeclProps(...): Assertion `!LexicalBlockStack.empty() && "Region stack mismatch, stack empty!"' failed.
#12 clang::CodeGen::CGDebugInfo::collectVarDeclProps
#13 clang::CodeGen::CGDebugInfo::getGlobalVariableForwardDeclaration
#14 clang::CodeGen::CGDebugInfo::EmitGlobalAlias
#15 clang::CodeGen::CodeGenModule::EmitAliasDefinition
```
Putting `nodebug` on `s` instead of `f` crashes the same way. Without `nodebug`, or without `-g`, it compiles. Because no debug info was emitted for the static, `EmitGlobalAlias` asks for a forward declaration after the function body is finished, so `LexicalBlockStack` is empty. The assert was added in #213153.
This issue was generated using AI
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs