================
@@ -230,6 +230,15 @@ llvm::MDNode *CodeGenTBAA::getTypeInfoHelper(const Type 
*Ty) {
               ->getString();
       TyName = Name;
     } else {
+      // For unnamed structs or unions C's compatible types rule applies. Two
+      // compatible types in different compilation units can have different
+      // mangled names, meaning the metadata emitted below would incorrectly
+      // mark them as no-alias. Use AnyPtr for such types in both C and C++, as
+      // C and C++ types may be visible when doing LTO.
----------------
rjmccall wrote:

I'd like this to note that
- using AnyPtr is over-conservative here, and we *could*  make this summarize 
the members as per the C compatibility rule in the future and
- this also covers anonymous structs and unions, which have a different 
compatibility rule, but it doesn't matter because you can never have a pointer 
to an anonymous struct or union.

https://github.com/llvm/llvm-project/pull/116596
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to