r313684 - Fix 32-bit buildbots by removing tests that are dependent on pointer-size comparisons.

Andrew Kaylor via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 19 14:43:01 PDT 2017


Author: akaylor
Date: Tue Sep 19 14:43:01 2017
New Revision: 313684

URL: http://llvm.org/viewvc/llvm-project?rev=313684&view=rev
Log:
Fix 32-bit buildbots by removing tests that are dependent on pointer-size comparisons.

The recently behavior in the code that these tests were meant to be checking will be ammended as soon as a suitable change can be properly reviewed.


Modified:
    cfe/trunk/test/CodeGen/nullptr-arithmetic.c
    cfe/trunk/test/Sema/pointer-addition.c
    cfe/trunk/test/SemaCXX/nullptr-arithmetic.cpp

Modified: cfe/trunk/test/CodeGen/nullptr-arithmetic.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/nullptr-arithmetic.c?rev=313684&r1=313683&r2=313684&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/nullptr-arithmetic.c (original)
+++ cfe/trunk/test/CodeGen/nullptr-arithmetic.c Tue Sep 19 14:43:01 2017
@@ -17,26 +17,18 @@ int8_t *test1(intptr_t n) {
 // CHECK: inttoptr
 // CHECK-NOT: getelementptr
 
-// This doesn't meet the idiom because the offset type isn't pointer-sized.
-int8_t *test2(int8_t n) {
-  return NULLPTRI8 + n;
-}
-// CHECK-LABEL: test2
-// CHECK: getelementptr
-// CHECK-NOT: inttoptr
-
 // This doesn't meet the idiom because the element type is larger than a byte.
-int16_t *test3(intptr_t n) {
+int16_t *test2(intptr_t n) {
   return (int16_t*)0 + n;
 }
-// CHECK-LABEL: test3
+// CHECK-LABEL: test2
 // CHECK: getelementptr
 // CHECK-NOT: inttoptr
 
 // This doesn't meet the idiom because the offset is subtracted.
-int8_t* test4(intptr_t n) {
+int8_t* test3(intptr_t n) {
   return NULLPTRI8 - n;
 }
-// CHECK-LABEL: test4
+// CHECK-LABEL: test3
 // CHECK: getelementptr
 // CHECK-NOT: inttoptr

Modified: cfe/trunk/test/Sema/pointer-addition.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/pointer-addition.c?rev=313684&r1=313683&r2=313684&view=diff
==============================================================================
--- cfe/trunk/test/Sema/pointer-addition.c (original)
+++ cfe/trunk/test/Sema/pointer-addition.c Tue Sep 19 14:43:01 2017
@@ -27,6 +27,4 @@ void a(S* b, void* c) {
   // Cases that don't match the GNU inttoptr idiom get a different warning.
   f = (char*)0 - i; // expected-warning {{performing pointer arithmetic on a null pointer has undefined behavior}}
   int *g = (int*)0 + i; // expected-warning {{performing pointer arithmetic on a null pointer has undefined behavior}}
-  unsigned char j = (unsigned char)b;
-  f = (char*)0 + j; // expected-warning {{performing pointer arithmetic on a null pointer has undefined behavior}}
 }

Modified: cfe/trunk/test/SemaCXX/nullptr-arithmetic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/nullptr-arithmetic.cpp?rev=313684&r1=313683&r2=313684&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/nullptr-arithmetic.cpp (original)
+++ cfe/trunk/test/SemaCXX/nullptr-arithmetic.cpp Tue Sep 19 14:43:01 2017
@@ -2,7 +2,7 @@
 
 #include <stdint.h>
 
-void f(intptr_t offset, int8_t b) {
+void f(intptr_t offset) {
   // A zero offset from a nullptr is OK.
   char *f = (char*)nullptr + 0;
   int *g = (int*)0 + 0;
@@ -13,7 +13,6 @@ void f(intptr_t offset, int8_t b) {
   // Cases that don't match the GNU inttoptr idiom get a different warning.
   f = (char*)0 - offset; // expected-warning {{performing pointer arithmetic on a null pointer has undefined behavior if the offset is nonzero}}
   g = (int*)0 + offset; // expected-warning {{performing pointer arithmetic on a null pointer has undefined behavior if the offset is nonzero}}
-  f = (char*)0 + b; // expected-warning {{performing pointer arithmetic on a null pointer has undefined behavior if the offset is nonzero}}
 }
 
 // Value-dependent pointer arithmetic should not produce a nullptr warning.




More information about the cfe-commits mailing list