[PATCH] [PowerPC, Darwin, CodeGen] fix bug 15726
David Fang
fang at csl.cornell.edu
Fri May 10 17:09:17 PDT 2013
Hi,
Here's a patch (with test case) for:
http://llvm.org/bugs/show_bug.cgi?id=15726
ptrdiff_t was wrongly set to long on powerpc-darwin8 (PPC32).
This patch corrects it to int.
Could someone please review/comment/commit?
Thanks.
Fang
--
David Fang
http://www.csl.cornell.edu/~fang/
-------------- next part --------------
diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp
index 95334e0..7e8cf5c 100644
--- a/lib/Basic/Targets.cpp
+++ b/lib/Basic/Targets.cpp
@@ -1220,6 +1220,7 @@ public:
: DarwinTargetInfo<PPC32TargetInfo>(triple) {
HasAlignMac68kSupport = true;
BoolWidth = BoolAlign = 32; //XXX support -mone-byte-bool?
+ PtrDiffType = SignedInt; // for http://llvm.org/bugs/show_bug.cgi?id=15726
LongLongAlign = 32;
SuitableAlign = 128;
DescriptionString = "E-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-"
diff --git a/test/CodeGen/ppc32-darwin-types.c b/test/CodeGen/ppc32-darwin-types.c
new file mode 100644
index 0000000..bddd8cb
--- /dev/null
+++ b/test/CodeGen/ppc32-darwin-types.c
@@ -0,0 +1,3 @@
+// REQUIRES: ppc32-registered-target
+// RUN: %clang_cc1 -triple powerpc-apple-darwin8 -dM -E - %s | FileCheck %s
+// CHECK: #define __PTRDIFF_TYPE__ int
More information about the cfe-commits
mailing list