rogfer01 created this revision. `__unaligned` is not currently mangled in any way and as such is not a relevant qualifier for substitutions. This may cause that, when it is the only qualifier, the substitution is added twice which triggers an assertion.
The simplest thing to do is to remove the qualifier preemptively. https://reviews.llvm.org/D33398 Files: lib/AST/ItaniumMangle.cpp test/CodeGenCXX/pr33080.cpp Index: test/CodeGenCXX/pr33080.cpp =================================================================== --- /dev/null +++ test/CodeGenCXX/pr33080.cpp @@ -0,0 +1,5 @@ +// RUN: %clang_cc1 -triple %itanium_abi_triple -fms-extensions -emit-llvm -o- %s | FileCheck %s + +void f(__unaligned struct A*) {} + +// CHECK: define void @_Z1fP1A(%struct.A*) Index: lib/AST/ItaniumMangle.cpp =================================================================== --- lib/AST/ItaniumMangle.cpp +++ lib/AST/ItaniumMangle.cpp @@ -2326,6 +2326,12 @@ // substitution at the original type. } + // __unaligned is not currently mangled in any way. This implies that it is + // not a relevant qualifier for substitutions (while CVR and maybe others + // are). This triggers an assertion when this is the only qualifier and the + // unqualified type is a class. So let's remove it preventively here. + quals.removeUnaligned(); + if (quals) { mangleQualifiers(quals); // Recurse: even if the qualified type isn't yet substitutable,
Index: test/CodeGenCXX/pr33080.cpp =================================================================== --- /dev/null +++ test/CodeGenCXX/pr33080.cpp @@ -0,0 +1,5 @@ +// RUN: %clang_cc1 -triple %itanium_abi_triple -fms-extensions -emit-llvm -o- %s | FileCheck %s + +void f(__unaligned struct A*) {} + +// CHECK: define void @_Z1fP1A(%struct.A*) Index: lib/AST/ItaniumMangle.cpp =================================================================== --- lib/AST/ItaniumMangle.cpp +++ lib/AST/ItaniumMangle.cpp @@ -2326,6 +2326,12 @@ // substitution at the original type. } + // __unaligned is not currently mangled in any way. This implies that it is + // not a relevant qualifier for substitutions (while CVR and maybe others + // are). This triggers an assertion when this is the only qualifier and the + // unqualified type is a class. So let's remove it preventively here. + quals.removeUnaligned(); + if (quals) { mangleQualifiers(quals); // Recurse: even if the qualified type isn't yet substitutable,
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits