[PATCH] D33398: Remove __unaligned preventively when mangling types in Itanium ABI
Roger Ferrer Ibanez via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon May 22 02:39:30 PDT 2017
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,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33398.99727.patch
Type: text/x-patch
Size: 1032 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170522/ce995cf1/attachment.bin>
More information about the cfe-commits
mailing list