[PATCH] [-cxx-abi microsoft] INT_MIN is mangled like -INT_MIN
David Majnemer
david.majnemer at gmail.com
Tue Aug 13 03:34:19 PDT 2013
Hi rnk, cdavis5x,
We should mangle INT_MIN like -INT_MIN.
This fixes PR16871.
http://llvm-reviews.chandlerc.com/D1376
Files:
lib/AST/MicrosoftMangle.cpp
test/CodeGenCXX/mangle-ms-templates.cpp
Index: lib/AST/MicrosoftMangle.cpp
===================================================================
--- lib/AST/MicrosoftMangle.cpp
+++ lib/AST/MicrosoftMangle.cpp
@@ -367,7 +367,10 @@
// <number> ::= [?] <decimal digit> # 1 <= Number <= 10
// ::= [?] <hex digit>+ @ # 0 or > 9; A = 0, B = 1, etc...
// ::= [?] @ # 0 (alternate mangling, not emitted by VC)
- if (Value.isSigned() && Value.isNegative()) {
+ //
+ // N.B. The representation of signed values that are their smallest possible
+ // value omits the question mark.
+ if (Value.isSigned() && Value.isNegative() && !Value.isMinSignedValue()) {
Out << '?';
mangleNumber(llvm::APSInt(Value.abs()));
return;
Index: test/CodeGenCXX/mangle-ms-templates.cpp
===================================================================
--- test/CodeGenCXX/mangle-ms-templates.cpp
+++ test/CodeGenCXX/mangle-ms-templates.cpp
@@ -108,6 +108,10 @@
IntTemplate<65535> ffff;
// CHECK: call {{.*}} @"\01??0?$IntTemplate@$0PPPP@@@QAE at XZ"
// X64: call {{.*}} @"\01??0?$IntTemplate@$0PPPP@@@QEAA at XZ"
+
+ IntTemplate<-2147483648> IntMin;
+// CHECK: call {{.*}} @"\01??0?$IntTemplate@$0IAAAAAAA@@@QAE at XZ"
+// X64: call {{.*}} @"\01??0?$IntTemplate@$0IAAAAAAA@@@QEAA at XZ"
}
namespace space {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1376.1.patch
Type: text/x-patch
Size: 1281 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130813/7b3c0e09/attachment.bin>
More information about the cfe-commits
mailing list