[PATCH] D141424: [clang][Sema] Fix uninitialized `SourceLocation` for types with multiple attributes and macros.

Volodymyr Sapsai via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 10 13:05:13 PST 2023


vsapsai added a comment.

Want to note that originally the issue was noticed with the modules because we serialize and deserialize `PointerTypeLoc::starLoc` and on deserialization we assert if the value is too big. With uninitialized memory the value can be too big //sometimes// and clang was failing intermittently. For testing don't use modules anymore and call `PointerTypeLoc::getStarLoc` directly to make it simpler and more reliable.



================
Comment at: clang/lib/Sema/SemaType.cpp:6509-6512
     if (AtomicTypeLoc ATL = CurrTL.getAs<AtomicTypeLoc>()) {
       fillAtomicQualLoc(ATL, D.getTypeObject(i));
       CurrTL = ATL.getValueLoc().getUnqualifiedLoc();
     }
----------------
Didn't move `AtomicTypeLoc` into the `switch` because it is peeled off only once and not in the `while` loop unlike other TypeLocs.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D141424/new/

https://reviews.llvm.org/D141424



More information about the cfe-commits mailing list