[clang] [clang] Fix ASTWriter crash after merging named enums (PR #114240)

Volodymyr Sapsai via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 21 13:08:44 PST 2025


https://github.com/vsapsai commented:

I've realized that the test doesn't have to be Objective-C, the failure is reproducible in C. Curiously, we aren't hitting the assertion in C++/Objective-C++ but I don't know why.

I wanted to try defining the enums in different scopes (e.g. in a struct) and see how it works. Consequences for scopes aren't clear, so that's worth taking another look.

A big surprise for me was that the assertion happens in the stack trace
```
 #7 0x0000000105168664 clang::ASTWriter::WriteCUDAPragmas(clang::Sema&)
 #8 0x00000001033ea29c clang::ASTWriter::WriteFPPragmaOptions(clang::FPOptionsOverride const&)
 #9 0x00000001033e4e70 clang::ASTWriter::WriteIdentifierTable(clang::Preprocessor&, clang::IdentifierResolver*, bool)
```

The fact that `WriteCUDAPragmas` is somehow involved while we have no CUDA pragmas is very suspicious.

https://github.com/llvm/llvm-project/pull/114240


More information about the cfe-commits mailing list