Skip to content

Commit 8b75d50

Browse files
committed
[Mips] Correctly define IntPtrType
Mips was the only architecture having PtrDiffType = SignedInt and IntPtrType = SignedLong This fixes a problem on mipsel-windows-gnu triple, where uintptr_t was wrongly defined as unsigned long instead of unsigned int, leading to problems in compiler-rt.
1 parent 5676478 commit 8b75d50

File tree

2 files changed

+35
-35
lines changed

2 files changed

+35
-35
lines changed

clang/lib/Basic/Targets/Mips.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ class LLVM_LIBRARY_VISIBILITY MipsTargetInfo : public TargetInfo {
129129
LongWidth = LongAlign = 32;
130130
MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 32;
131131
PointerWidth = PointerAlign = 32;
132-
PtrDiffType = SignedInt;
132+
PtrDiffType = IntPtrType = SignedInt;
133133
SizeType = UnsignedInt;
134134
SuitableAlign = 64;
135135
}
@@ -155,7 +155,7 @@ class LLVM_LIBRARY_VISIBILITY MipsTargetInfo : public TargetInfo {
155155
IntMaxType = Int64Type;
156156
LongWidth = LongAlign = 64;
157157
PointerWidth = PointerAlign = 64;
158-
PtrDiffType = SignedLong;
158+
PtrDiffType = IntPtrType = SignedLong;
159159
SizeType = UnsignedLong;
160160
}
161161

@@ -165,7 +165,7 @@ class LLVM_LIBRARY_VISIBILITY MipsTargetInfo : public TargetInfo {
165165
IntMaxType = Int64Type;
166166
LongWidth = LongAlign = 32;
167167
PointerWidth = PointerAlign = 32;
168-
PtrDiffType = SignedInt;
168+
PtrDiffType = IntPtrType = SignedInt;
169169
SizeType = UnsignedInt;
170170
}
171171

clang/test/Preprocessor/init-mips.c

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,10 @@
8080
// MIPS32BE:#define __INTMAX_MAX__ 9223372036854775807LL
8181
// MIPS32BE:#define __INTMAX_TYPE__ long long int
8282
// MIPS32BE:#define __INTMAX_WIDTH__ 64
83-
// MIPS32BE:#define __INTPTR_FMTd__ "ld"
84-
// MIPS32BE:#define __INTPTR_FMTi__ "li"
85-
// MIPS32BE:#define __INTPTR_MAX__ 2147483647L
86-
// MIPS32BE:#define __INTPTR_TYPE__ long int
83+
// MIPS32BE:#define __INTPTR_FMTd__ "d"
84+
// MIPS32BE:#define __INTPTR_FMTi__ "i"
85+
// MIPS32BE:#define __INTPTR_MAX__ 2147483647
86+
// MIPS32BE:#define __INTPTR_TYPE__ int
8787
// MIPS32BE:#define __INTPTR_WIDTH__ 32
8888
// MIPS32BE:#define __INT_FAST16_FMTd__ "hd"
8989
// MIPS32BE:#define __INT_FAST16_FMTi__ "hi"
@@ -185,8 +185,8 @@
185185
// MIPS32BE:#define __UINTMAX_MAX__ 18446744073709551615ULL
186186
// MIPS32BE:#define __UINTMAX_TYPE__ long long unsigned int
187187
// MIPS32BE:#define __UINTMAX_WIDTH__ 64
188-
// MIPS32BE:#define __UINTPTR_MAX__ 4294967295UL
189-
// MIPS32BE:#define __UINTPTR_TYPE__ long unsigned int
188+
// MIPS32BE:#define __UINTPTR_MAX__ 4294967295U
189+
// MIPS32BE:#define __UINTPTR_TYPE__ unsigned int
190190
// MIPS32BE:#define __UINTPTR_WIDTH__ 32
191191
// MIPS32BE:#define __UINT_FAST16_MAX__ 65535
192192
// MIPS32BE:#define __UINT_FAST16_TYPE__ unsigned short
@@ -300,10 +300,10 @@
300300
// MIPS32EL:#define __INTMAX_MAX__ 9223372036854775807LL
301301
// MIPS32EL:#define __INTMAX_TYPE__ long long int
302302
// MIPS32EL:#define __INTMAX_WIDTH__ 64
303-
// MIPS32EL:#define __INTPTR_FMTd__ "ld"
304-
// MIPS32EL:#define __INTPTR_FMTi__ "li"
305-
// MIPS32EL:#define __INTPTR_MAX__ 2147483647L
306-
// MIPS32EL:#define __INTPTR_TYPE__ long int
303+
// MIPS32EL:#define __INTPTR_FMTd__ "d"
304+
// MIPS32EL:#define __INTPTR_FMTi__ "i"
305+
// MIPS32EL:#define __INTPTR_MAX__ 2147483647
306+
// MIPS32EL:#define __INTPTR_TYPE__ int
307307
// MIPS32EL:#define __INTPTR_WIDTH__ 32
308308
// MIPS32EL:#define __INT_FAST16_FMTd__ "hd"
309309
// MIPS32EL:#define __INT_FAST16_FMTi__ "hi"
@@ -402,8 +402,8 @@
402402
// MIPS32EL:#define __UINTMAX_MAX__ 18446744073709551615ULL
403403
// MIPS32EL:#define __UINTMAX_TYPE__ long long unsigned int
404404
// MIPS32EL:#define __UINTMAX_WIDTH__ 64
405-
// MIPS32EL:#define __UINTPTR_MAX__ 4294967295UL
406-
// MIPS32EL:#define __UINTPTR_TYPE__ long unsigned int
405+
// MIPS32EL:#define __UINTPTR_MAX__ 4294967295U
406+
// MIPS32EL:#define __UINTPTR_TYPE__ unsigned int
407407
// MIPS32EL:#define __UINTPTR_WIDTH__ 32
408408
// MIPS32EL:#define __UINT_FAST16_MAX__ 65535
409409
// MIPS32EL:#define __UINT_FAST16_TYPE__ unsigned short
@@ -547,10 +547,10 @@
547547
// MIPSN32BE: #define __INTMAX_MAX__ 9223372036854775807LL
548548
// MIPSN32BE: #define __INTMAX_TYPE__ long long int
549549
// MIPSN32BE: #define __INTMAX_WIDTH__ 64
550-
// MIPSN32BE: #define __INTPTR_FMTd__ "ld"
551-
// MIPSN32BE: #define __INTPTR_FMTi__ "li"
552-
// MIPSN32BE: #define __INTPTR_MAX__ 2147483647L
553-
// MIPSN32BE: #define __INTPTR_TYPE__ long int
550+
// MIPSN32BE: #define __INTPTR_FMTd__ "d"
551+
// MIPSN32BE: #define __INTPTR_FMTi__ "i"
552+
// MIPSN32BE: #define __INTPTR_MAX__ 2147483647
553+
// MIPSN32BE: #define __INTPTR_TYPE__ int
554554
// MIPSN32BE: #define __INTPTR_WIDTH__ 32
555555
// MIPSN32BE: #define __INT_FAST16_FMTd__ "hd"
556556
// MIPSN32BE: #define __INT_FAST16_FMTi__ "hi"
@@ -684,12 +684,12 @@
684684
// MIPSN32BE: #define __UINTMAX_MAX__ 18446744073709551615ULL
685685
// MIPSN32BE: #define __UINTMAX_TYPE__ long long unsigned int
686686
// MIPSN32BE: #define __UINTMAX_WIDTH__ 64
687-
// MIPSN32BE: #define __UINTPTR_FMTX__ "lX"
688-
// MIPSN32BE: #define __UINTPTR_FMTo__ "lo"
689-
// MIPSN32BE: #define __UINTPTR_FMTu__ "lu"
690-
// MIPSN32BE: #define __UINTPTR_FMTx__ "lx"
691-
// MIPSN32BE: #define __UINTPTR_MAX__ 4294967295UL
692-
// MIPSN32BE: #define __UINTPTR_TYPE__ long unsigned int
687+
// MIPSN32BE: #define __UINTPTR_FMTX__ "X"
688+
// MIPSN32BE: #define __UINTPTR_FMTo__ "o"
689+
// MIPSN32BE: #define __UINTPTR_FMTu__ "u"
690+
// MIPSN32BE: #define __UINTPTR_FMTx__ "x"
691+
// MIPSN32BE: #define __UINTPTR_MAX__ 4294967295U
692+
// MIPSN32BE: #define __UINTPTR_TYPE__ unsigned int
693693
// MIPSN32BE: #define __UINTPTR_WIDTH__ 32
694694
// MIPSN32BE: #define __UINT_FAST16_FMTX__ "hX"
695695
// MIPSN32BE: #define __UINT_FAST16_FMTo__ "ho"
@@ -864,10 +864,10 @@
864864
// MIPSN32EL: #define __INTMAX_MAX__ 9223372036854775807LL
865865
// MIPSN32EL: #define __INTMAX_TYPE__ long long int
866866
// MIPSN32EL: #define __INTMAX_WIDTH__ 64
867-
// MIPSN32EL: #define __INTPTR_FMTd__ "ld"
868-
// MIPSN32EL: #define __INTPTR_FMTi__ "li"
869-
// MIPSN32EL: #define __INTPTR_MAX__ 2147483647L
870-
// MIPSN32EL: #define __INTPTR_TYPE__ long int
867+
// MIPSN32EL: #define __INTPTR_FMTd__ "d"
868+
// MIPSN32EL: #define __INTPTR_FMTi__ "i"
869+
// MIPSN32EL: #define __INTPTR_MAX__ 2147483647
870+
// MIPSN32EL: #define __INTPTR_TYPE__ int
871871
// MIPSN32EL: #define __INTPTR_WIDTH__ 32
872872
// MIPSN32EL: #define __INT_FAST16_FMTd__ "hd"
873873
// MIPSN32EL: #define __INT_FAST16_FMTi__ "hi"
@@ -1001,12 +1001,12 @@
10011001
// MIPSN32EL: #define __UINTMAX_MAX__ 18446744073709551615ULL
10021002
// MIPSN32EL: #define __UINTMAX_TYPE__ long long unsigned int
10031003
// MIPSN32EL: #define __UINTMAX_WIDTH__ 64
1004-
// MIPSN32EL: #define __UINTPTR_FMTX__ "lX"
1005-
// MIPSN32EL: #define __UINTPTR_FMTo__ "lo"
1006-
// MIPSN32EL: #define __UINTPTR_FMTu__ "lu"
1007-
// MIPSN32EL: #define __UINTPTR_FMTx__ "lx"
1008-
// MIPSN32EL: #define __UINTPTR_MAX__ 4294967295UL
1009-
// MIPSN32EL: #define __UINTPTR_TYPE__ long unsigned int
1004+
// MIPSN32EL: #define __UINTPTR_FMTX__ "X"
1005+
// MIPSN32EL: #define __UINTPTR_FMTo__ "o"
1006+
// MIPSN32EL: #define __UINTPTR_FMTu__ "u"
1007+
// MIPSN32EL: #define __UINTPTR_FMTx__ "x"
1008+
// MIPSN32EL: #define __UINTPTR_MAX__ 4294967295U
1009+
// MIPSN32EL: #define __UINTPTR_TYPE__ unsigned int
10101010
// MIPSN32EL: #define __UINTPTR_WIDTH__ 32
10111011
// MIPSN32EL: #define __UINT_FAST16_FMTX__ "hX"
10121012
// MIPSN32EL: #define __UINT_FAST16_FMTo__ "ho"

0 commit comments

Comments
 (0)