llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang

@llvm/pr-subscribers-backend-x86

Author: None (Sirraide)

<details>
<summary>Changes</summary>

GCC 14 also made this an error by default, and I thought it’d make sense to 
follow suit.

---

Patch is 146.31 KiB, truncated to 20.00 KiB below, full version: 
https://github.com/llvm/llvm-project/pull/157364.diff


98 Files Affected:

- (modified) clang/docs/ReleaseNotes.rst (+3) 
- (modified) clang/include/clang/Basic/DiagnosticSemaKinds.td (+1-1) 
- (modified) clang/test/APINotes/nullability.c (+1-1) 
- (modified) clang/test/APINotes/nullability.m (+2-2) 
- (modified) clang/test/APINotes/types.m (+8-8) 
- (modified) clang/test/AST/ByteCode/atomic.c (+2-2) 
- (modified) clang/test/AST/ByteCode/c.c (+1-1) 
- (modified) clang/test/Analysis/OSAtomic_mac.c (+1-1) 
- (modified) clang/test/Analysis/bsd-string.c (+1-1) 
- (modified) clang/test/Analysis/novoidtypecrash.c (+1-1) 
- (modified) clang/test/Analysis/override-werror.c (+3-3) 
- (modified) clang/test/Analysis/uninit-vals-union.c (+2-1) 
- (modified) clang/test/C/C23/n3007.c (+1-1) 
- (modified) clang/test/C/C2y/n3369.c (+3-3) 
- (modified) clang/test/C/drs/dr0xx.c (+1-1) 
- (modified) clang/test/CodeGen/2008-03-05-syncPtr.c (+1-1) 
- (modified) clang/test/CodeGen/X86/cmpccxadd-builtins-error.c (+1-1) 
- (modified) clang/test/CodeGen/X86/math-builtins.c (+6-6) 
- (modified) clang/test/CodeGen/arm64-microsoft-intrinsics.c (+13-6) 
- (modified) clang/test/CodeGen/builtin-rename.c (+1-1) 
- (modified) clang/test/CodeGen/ms-intrinsics-underaligned.c (+1-1) 
- (modified) clang/test/CodeGen/ubsan-pass-object-size.c (+2-1) 
- (modified) clang/test/CodeGen/vla.c (+2-2) 
- (modified) clang/test/CodeGen/vlt_to_pointer.c (+1-1) 
- (modified) clang/test/FixIt/fixit-objc-arc.m (+3-3) 
- (modified) clang/test/Frontend/fixed_point_unknown_conversions.c (+2-2) 
- (modified) clang/test/Index/preamble.c (+1-1) 
- (modified) clang/test/Index/warning-flags.c (+3-3) 
- (modified) clang/test/Misc/remap-file.c (+3-3) 
- (modified) clang/test/Modules/diamond-pch.c (+1-1) 
- (modified) clang/test/Modules/diamond.c (+1-1) 
- (modified) clang/test/Modules/serialized-diags.m (+2-2) 
- (modified) clang/test/OpenMP/vla_crash.c (+2-2) 
- (modified) clang/test/PCH/functions.c (+1-1) 
- (modified) clang/test/PCH/objc_exprs.m (+5-5) 
- (modified) clang/test/PCH/objc_kindof.m (+1-1) 
- (modified) clang/test/PCH/variables.c (+1-1) 
- (modified) clang/test/Parser/declarators.c (+1-1) 
- (modified) clang/test/Sema/MicrosoftExtensions.c (+1-1) 
- (modified) clang/test/Sema/atomic-expr.c (+2-2) 
- (modified) clang/test/Sema/atomic-ops.c (+7-7) 
- (modified) clang/test/Sema/attr-format.c (+1-1) 
- (modified) clang/test/Sema/c2x-auto.c (+1-1) 
- (modified) clang/test/Sema/conditional-expr.c (+3-3) 
- (modified) clang/test/Sema/decl-type-merging.c (+2-2) 
- (modified) clang/test/Sema/enum.c (+1-1) 
- (modified) clang/test/Sema/format-strings.c (+2-2) 
- (modified) clang/test/Sema/function.c (+2-2) 
- (modified) clang/test/Sema/merge-decls.c (+2-2) 
- (modified) clang/test/Sema/nullability.c (+7-7) 
- (modified) clang/test/Sema/pass-object-size.c (+1-1) 
- (modified) clang/test/Sema/ptrauth-atomic-ops.c (+1-1) 
- (modified) clang/test/Sema/ptrauth.c (+7-7) 
- (modified) clang/test/Sema/static-array.c (+2-2) 
- (modified) clang/test/Sema/struct-compat.c (+1-1) 
- (modified) clang/test/Sema/var-redecl.c (+1-1) 
- (modified) clang/test/Sema/vector-assign.c (+1-1) 
- (modified) clang/test/Sema/vla.c (+2-2) 
- (modified) clang/test/SemaObjC/arc-decls.m (+1-1) 
- (modified) clang/test/SemaObjC/arc-objcbridge-related-attribute.m (+5-5) 
- (modified) clang/test/SemaObjC/arc.m (+3-3) 
- (modified) clang/test/SemaObjC/attr-objc-NSObject.m (+1-1) 
- (modified) clang/test/SemaObjC/check-objcbridge-related-attribute-lookup.m 
(+6-6) 
- (modified) clang/test/SemaObjC/class-method-self.m (+2-2) 
- (modified) clang/test/SemaObjC/comptypes-1.m (+12-12) 
- (modified) clang/test/SemaObjC/comptypes-4.m (+1-1) 
- (modified) clang/test/SemaObjC/comptypes-5.m (+1-1) 
- (modified) clang/test/SemaObjC/comptypes-6.m (+1-1) 
- (modified) clang/test/SemaObjC/comptypes-7.m (+8-8) 
- (modified) clang/test/SemaObjC/conditional-expr-2.m (+1-1) 
- (modified) clang/test/SemaObjC/conditional-expr.m (+3-3) 
- (modified) clang/test/SemaObjC/id.m (+2-2) 
- (modified) clang/test/SemaObjC/incompatible-protocol-qualified-types.m (+3-3) 
- (modified) clang/test/SemaObjC/instancetype.m (+5-5) 
- (modified) clang/test/SemaObjC/ivar-lookup.m (+1-1) 
- (modified) clang/test/SemaObjC/kindof.m (+21-21) 
- (modified) clang/test/SemaObjC/method-prototype-scope.m (+1-1) 
- (modified) clang/test/SemaObjC/nullability.m (+42-42) 
- (modified) clang/test/SemaObjC/objcbridge-related-attribute.m (+5-5) 
- (modified) clang/test/SemaObjC/parameterized_classes.m (+4-4) 
- (modified) clang/test/SemaObjC/parameterized_classes_arc.m (+8-8) 
- (modified) clang/test/SemaObjC/parameterized_classes_subst.m (+83-83) 
- (modified) clang/test/SemaObjC/protocol-typecheck.m (+1-1) 
- (modified) clang/test/SemaObjC/protocol-warn.m (+1-1) 
- (modified) clang/test/SemaObjC/related-result-type-inference.m (+2-2) 
- (modified) clang/test/SemaObjC/unqualified-to-qualified-class-warn.m (+1-1) 
- (modified) clang/test/SemaObjC/warn-incompatible-builtin-types.m (+9-9) 
- (modified) clang/test/SemaObjC/warn-superclass-method-mismatch.m (+1-1) 
- (modified) clang/test/SemaObjCXX/blocks.mm (+1-1) 
- (modified) clang/test/SemaObjCXX/objc-pointer-conv.mm (+2-2) 
- (modified) clang/test/SemaObjCXX/overload.mm (+5-5) 
- (modified) clang/test/SemaObjCXX/parameterized_classes_subst.mm (+3-3) 
- (modified) clang/test/SemaObjCXX/related-result-type-inference.mm (+2-2) 
- (modified) clang/test/SemaOpenACC/combined-construct-if-clause.c (+1-1) 
- (modified) clang/test/SemaOpenACC/compute-construct-if-clause.c (+1-1) 
- (modified) clang/test/SemaOpenCL/address-spaces.cl (+3-4) 
- (modified) clang/test/SemaOpenCL/atomic-ops.cl (+2-2) 
- (modified) clang/test/SemaOpenCL/to_addr_builtin.cl (+2-2) 


``````````diff
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index d1ef91b7e7c14..04815d064b4ea 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -58,6 +58,9 @@ C/C++ Language Potentially Breaking Changes
 
 - The ``__has_builtin`` function now only considers the currently active 
target when being used with target offloading.
 
+- The ``-Wincompatible-pointer-types`` diagnostic now defaults to an error;
+  it can still be downgraded to a warning by passing 
``-Wno-error=incompatible-pointer-types``.
+
 C++ Specific Potentially Breaking Changes
 -----------------------------------------
 - For C++20 modules, the Reduced BMI mode will be the default option. This may 
introduce
diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td 
b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index 711efbe727892..097c0b92d53dc 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -9048,7 +9048,7 @@ def ext_typecheck_convert_incompatible_pointer : ExtWarn<
   "; take the address with &|"
   "; remove *|"
   "; remove &}3">,
-  InGroup<IncompatiblePointerTypes>;
+  InGroup<IncompatiblePointerTypes>, DefaultError;
 def err_typecheck_convert_incompatible_pointer : Error<
   "incompatible pointer types "
   "%select{%diff{assigning to $ from $|assigning to different types}0,1"
diff --git a/clang/test/APINotes/nullability.c 
b/clang/test/APINotes/nullability.c
index e07fc2e5c1174..4b310d4fb0068 100644
--- a/clang/test/APINotes/nullability.c
+++ b/clang/test/APINotes/nullability.c
@@ -15,7 +15,7 @@ int main() {
 
   take_pointer_and_int(0, 0); // expected-warning{{null passed to a callee 
that requires a non-null argument}}
 
-  float *fp = global_int; // expected-warning{{incompatible pointer types 
initializing 'float *' with an expression of type 'int * _Nonnull'}}
+  float *fp = global_int; // expected-error{{incompatible pointer types 
initializing 'float *' with an expression of type 'int * _Nonnull'}}
   return 0;
 }
 
diff --git a/clang/test/APINotes/nullability.m 
b/clang/test/APINotes/nullability.m
index 21ec6680fa714..2c32caf6260a6 100644
--- a/clang/test/APINotes/nullability.m
+++ b/clang/test/APINotes/nullability.m
@@ -11,10 +11,10 @@ int main() {
   A *a;
 
 #if SWIFT_VERSION_3_0
-  float *fp =  // expected-warning{{incompatible pointer types initializing 
'float *' with an expression of type 'A * _Nullable'}}
+  float *fp =  // expected-error{{incompatible pointer types initializing 
'float *' with an expression of type 'A * _Nullable'}}
     [a transform: 0 integer: 0];
 #else
-  float *fp =  // expected-warning{{incompatible pointer types initializing 
'float *' with an expression of type 'A *'}}
+  float *fp =  // expected-error{{incompatible pointer types initializing 
'float *' with an expression of type 'A *'}}
     [a transform: 0 integer: 0]; // expected-warning{{null passed to a callee 
that requires a non-null argument}}
 #endif
 
diff --git a/clang/test/APINotes/types.m b/clang/test/APINotes/types.m
index 752f102643284..9e78d406b9ed9 100644
--- a/clang/test/APINotes/types.m
+++ b/clang/test/APINotes/types.m
@@ -12,17 +12,17 @@
 // CHECK-NEXT: } AnonEnumWithTypedefName
 
 void test(OverriddenTypes *overridden) {
-  int *ip1 = global_int_ptr; // expected-warning{{incompatible pointer types 
initializing 'int *' with an expression of type 'double (*)(int, int)'}}
+  int *ip1 = global_int_ptr; // expected-error{{incompatible pointer types 
initializing 'int *' with an expression of type 'double (*)(int, int)'}}
 
-  int *ip2 = global_int_fun( // expected-warning{{incompatible pointer types 
initializing 'int *' with an expression of type 'char *'}}
-               ip2, // expected-warning{{incompatible pointer types passing 
'int *' to parameter of type 'double *'}}
-               ip2); // expected-warning{{incompatible pointer types passing 
'int *' to parameter of type 'float *'}}
+  int *ip2 = global_int_fun( // expected-error{{incompatible pointer types 
initializing 'int *' with an expression of type 'char *'}}
+               ip2, // expected-error{{incompatible pointer types passing 'int 
*' to parameter of type 'double *'}}
+               ip2); // expected-error{{incompatible pointer types passing 
'int *' to parameter of type 'float *'}}
 
-  int *ip3 = [overridden // expected-warning{{incompatible pointer types 
initializing 'int *' with an expression of type 'char *'}}
-                methodToMangle: ip3 // expected-warning{{incompatible pointer 
types sending 'int *' to parameter of type 'double *'}}
-                        second: ip3]; // expected-warning{{incompatible 
pointer types sending 'int *' to parameter of type 'float *'}}
+  int *ip3 = [overridden // expected-error{{incompatible pointer types 
initializing 'int *' with an expression of type 'char *'}}
+                methodToMangle: ip3 // expected-error{{incompatible pointer 
types sending 'int *' to parameter of type 'double *'}}
+                        second: ip3]; // expected-error{{incompatible pointer 
types sending 'int *' to parameter of type 'float *'}}
 
-  int *ip4 = overridden.intPropertyToMangle; // expected-warning{{incompatible 
pointer types initializing 'int *' with an expression of type 'double *'}}
+  int *ip4 = overridden.intPropertyToMangle; // expected-error{{incompatible 
pointer types initializing 'int *' with an expression of type 'double *'}}
 }
 
 // expected-note@SomeKit/SomeKit.h:42{{passing argument to parameter 'ptr' 
here}}
diff --git a/clang/test/AST/ByteCode/atomic.c b/clang/test/AST/ByteCode/atomic.c
index c8469d4a938b8..a93787ccd1e02 100644
--- a/clang/test/AST/ByteCode/atomic.c
+++ b/clang/test/AST/ByteCode/atomic.c
@@ -8,8 +8,8 @@ _Atomic int ai = 0;
 // FIXME: &ai is an address constant, so this should be accepted as an
 // initializer, but the bit-cast inserted due to the pointer conversion is
 // tripping up the test for whether the initializer is a constant expression.
-// The warning is correct but the error is not.
-_Atomic(int *) aip3 = &ai; // both-warning {{incompatible pointer types 
initializing '_Atomic(int *)' with an expression of type '_Atomic(int) *'}} \
+// The first error is correct; the second is not.
+_Atomic(int *) aip3 = &ai; // both-error {{incompatible pointer types 
initializing '_Atomic(int *)' with an expression of type '_Atomic(int) *'}} \
                            // both-error {{initializer element is not a 
compile-time constant}}
 
 #include <stdatomic.h>
diff --git a/clang/test/AST/ByteCode/c.c b/clang/test/AST/ByteCode/c.c
index b6d2a69271afb..6681a4f427093 100644
--- a/clang/test/AST/ByteCode/c.c
+++ b/clang/test/AST/ByteCode/c.c
@@ -349,7 +349,7 @@ const unsigned char _str2[] = {S[0], S[1], S[2], S[3], 
S[4], S[5], S[6], S[7]};
 const int compared = strcmp(_str, (const char *)_str2); // all-error 
{{initializer element is not a compile-time constant}}
 
 
-const int compared2 = strcmp(strcmp, _str); // all-warning {{incompatible 
pointer types}} \
+const int compared2 = strcmp(strcmp, _str); // all-error {{incompatible 
pointer types}} \
                                             // all-error {{initializer element 
is not a compile-time constant}}
 
 int foo(x) // all-warning {{a function definition without a prototype is 
deprecated in all versions of C}}
diff --git a/clang/test/Analysis/OSAtomic_mac.c 
b/clang/test/Analysis/OSAtomic_mac.c
index 5cf7e93014323..9e3fef782de34 100644
--- a/clang/test/Analysis/OSAtomic_mac.c
+++ b/clang/test/Analysis/OSAtomic_mac.c
@@ -15,7 +15,7 @@ int *invalidSLocOnRedecl(void) {
   // something like "The "compare" part of CompareAndSwap depends on an
   // undefined value".
   int *b;
-  OSAtomicCompareAndSwapPtrBarrier(0, 0, &b); // no-crash
+  OSAtomicCompareAndSwapPtrBarrier(0, 0, (void**)&b); // no-crash
   return b;
 }
 
diff --git a/clang/test/Analysis/bsd-string.c b/clang/test/Analysis/bsd-string.c
index 93b2214786009..0c22dd0719132 100644
--- a/clang/test/Analysis/bsd-string.c
+++ b/clang/test/Analysis/bsd-string.c
@@ -137,5 +137,5 @@ void f11(void) {
 int a, b;
 void unknown_val_crash(void) {
   // We're unable to evaluate the integer-to-pointer cast.
-  strlcat(&b, a, 0); // no-crash
+  strlcat((char*)&b, a, 0); // no-crash
 }
diff --git a/clang/test/Analysis/novoidtypecrash.c 
b/clang/test/Analysis/novoidtypecrash.c
index 5af30c2010438..325dd505a4201 100644
--- a/clang/test/Analysis/novoidtypecrash.c
+++ b/clang/test/Analysis/novoidtypecrash.c
@@ -3,7 +3,7 @@ x;
 y(void **z) { // no-crash
   *z = x;
   int *w;
-  y(&w);
+  y((void**)&w);
   *w;
 }
 
diff --git a/clang/test/Analysis/override-werror.c 
b/clang/test/Analysis/override-werror.c
index e84c20fc0696f..1aeed80492cca 100644
--- a/clang/test/Analysis/override-werror.c
+++ b/clang/test/Analysis/override-werror.c
@@ -5,9 +5,9 @@
 // -Werror.  This allows basic warnings not to interfere with producing
 // analyzer results.
 
-char* f(int *p) {
-  return p; // expected-warning{{incompatible pointer types}} \
-               werror-warning{{incompatible pointer types}}
+void f(int *p) {
+  int; // expected-warning{{declaration does not declare anything}} \
+          werror-warning{{declaration does not declare anything}}
 }
 
 void g(int *p) {
diff --git a/clang/test/Analysis/uninit-vals-union.c 
b/clang/test/Analysis/uninit-vals-union.c
index e16cccfc9115a..3992a3a160c5e 100644
--- a/clang/test/Analysis/uninit-vals-union.c
+++ b/clang/test/Analysis/uninit-vals-union.c
@@ -1,4 +1,5 @@
 // RUN: %clang_analyze_cc1 -analyzer-checker=core.builtin -verify -Wno-unused 
%s
+// expected-no-diagnostics
 
 typedef union {
   int y;
@@ -8,6 +9,6 @@ typedef struct { int x; } A;
 
 void foo(void) {
   U u = {};
-  A *a = &u; // expected-warning{{incompatible pointer types}}
+  A *a = (A*)&u;
   a->x;      // no-crash
 }
diff --git a/clang/test/C/C23/n3007.c b/clang/test/C/C23/n3007.c
index 34ec419b71b27..b8b84519fc19d 100644
--- a/clang/test/C/C23/n3007.c
+++ b/clang/test/C/C23/n3007.c
@@ -13,7 +13,7 @@ void test_qualifiers(int x, const int y, int * restrict z) {
   static auto c = 1UL;
   int* pa = &a; // expected-warning {{initializing 'int *' with an expression 
of type 'const int *' discards qualifiers}}
   const int* pb = &b;
-  int* pc = &c; // expected-warning {{incompatible pointer types initializing 
'int *' with an expression of type 'unsigned long *'}}
+  int* pc = &c; // expected-error {{incompatible pointer types initializing 
'int *' with an expression of type 'unsigned long *'}}
 
   const int ci = 12;
   auto yup = ci;
diff --git a/clang/test/C/C2y/n3369.c b/clang/test/C/C2y/n3369.c
index db26040d8cf44..dd3125709279d 100644
--- a/clang/test/C/C2y/n3369.c
+++ b/clang/test/C/C2y/n3369.c
@@ -100,11 +100,11 @@ void test_funcs() {
   int i5[5];
   char c35[3][5];
   test_func_fix_fix(5, &c35, &i3, NULL);
-  test_func_fix_fix(5, &c35, &i5, NULL); // expected-warning {{incompatible 
pointer types passing 'int (*)[5]' to parameter of type 'int (*)[3]'}}
+  test_func_fix_fix(5, &c35, &i5, NULL); // expected-error {{incompatible 
pointer types passing 'int (*)[5]' to parameter of type 'int (*)[3]'}}
   test_func_fix_var(5, &c35, &i3, NULL);
-  test_func_fix_var(5, &c35, &i5, NULL); // expected-warning {{incompatible 
pointer types passing 'int (*)[5]' to parameter of type 'int (*)[3]'}}
+  test_func_fix_var(5, &c35, &i5, NULL); // expected-error {{incompatible 
pointer types passing 'int (*)[5]' to parameter of type 'int (*)[3]'}}
   test_func_fix_uns(5, &c35, &i3, NULL);
-  test_func_fix_uns(5, &c35, &i5, NULL); // expected-warning {{incompatible 
pointer types passing 'int (*)[5]' to parameter of type 'int (*)[3]'}}
+  test_func_fix_uns(5, &c35, &i5, NULL); // expected-error {{incompatible 
pointer types passing 'int (*)[5]' to parameter of type 'int (*)[3]'}}
 }
 
 void test_multidimensional_arrays() {
diff --git a/clang/test/C/drs/dr0xx.c b/clang/test/C/drs/dr0xx.c
index c2b1a5b4bbecd..77ade3c351171 100644
--- a/clang/test/C/drs/dr0xx.c
+++ b/clang/test/C/drs/dr0xx.c
@@ -459,7 +459,7 @@ void dr088_1(void) {
   /* Distinct type from the file scope forward declaration. */
   struct dr088_t_1;
   /* FIXME: this diagnostic could be improved to not be utterly baffling. */
-  dr088_f((struct dr088_t_1 *)0); /* expected-warning {{incompatible pointer 
types passing 'struct dr088_t_1 *' to parameter of type 'struct dr088_t_1 *'}} 
*/
+  dr088_f((struct dr088_t_1 *)0); /* expected-error {{incompatible pointer 
types passing 'struct dr088_t_1 *' to parameter of type 'struct dr088_t_1 *'}} 
*/
 }
 
 void dr088_2(struct dr088_t_1 *p) { /* Pointer to incomplete type. */ }
diff --git a/clang/test/CodeGen/2008-03-05-syncPtr.c 
b/clang/test/CodeGen/2008-03-05-syncPtr.c
index 8968a7dc2678c..30dc4f26e1d3e 100644
--- a/clang/test/CodeGen/2008-03-05-syncPtr.c
+++ b/clang/test/CodeGen/2008-03-05-syncPtr.c
@@ -34,7 +34,7 @@ int* foo5(int** a, int* b) {
 
 
 int* foo6(int** a, int*** b) {
-  return __sync_lock_test_and_set (a, b);
+  return __sync_lock_test_and_set (a, (int*)b);
 }
 // CHECK-LABEL: define{{.*}} ptr @foo6
 // CHECK: atomicrmw xchg {{.*}}, align 8
diff --git a/clang/test/CodeGen/X86/cmpccxadd-builtins-error.c 
b/clang/test/CodeGen/X86/cmpccxadd-builtins-error.c
index f7ecf12d0becf..d931c0eae01d4 100644
--- a/clang/test/CodeGen/X86/cmpccxadd-builtins-error.c
+++ b/clang/test/CodeGen/X86/cmpccxadd-builtins-error.c
@@ -12,5 +12,5 @@ long long test_cmpccxadd64(void *__A, long long __B, long 
long __C) {
 }
 
 long long test_cmpccxadd64_2(int *__A, long long __B, long long __C) {
-  return _cmpccxadd_epi64(__A, __B, __C, 3); // expected-warning 
{{incompatible pointer types passing 'int *' to parameter of type 'long long 
*'}}
+  return _cmpccxadd_epi64(__A, __B, __C, 3); // expected-error {{incompatible 
pointer types passing 'int *' to parameter of type 'long long *'}}
 }
diff --git a/clang/test/CodeGen/X86/math-builtins.c 
b/clang/test/CodeGen/X86/math-builtins.c
index 8a85d1f6c3a76..a56f8ba1ee385 100644
--- a/clang/test/CodeGen/X86/math-builtins.c
+++ b/clang/test/CodeGen/X86/math-builtins.c
@@ -1,9 +1,9 @@
-// RUN: %clang_cc1 -triple x86_64-unknown-unknown -w -o - -emit-llvm %s | 
FileCheck %s -check-prefix=NO__ERRNO
-// RUN: %clang_cc1 -triple x86_64-unknown-unknown -w -o - -emit-llvm 
-fmath-errno %s | FileCheck %s -check-prefix=HAS_ERRNO
-// RUN: %clang_cc1 -triple x86_64-unknown-unknown -w -o - -emit-llvm 
-disable-llvm-passes -O2 %s | FileCheck %s -check-prefix=NO__ERRNO
-// RUN: %clang_cc1 -triple x86_64-unknown-unknown -w -o - -emit-llvm 
-disable-llvm-passes -O2 -fmath-errno %s | FileCheck %s -check-prefix=HAS_ERRNO
-// RUN: %clang_cc1 -triple x86_64-unknown-unknown-gnu -w -o - -emit-llvm 
-fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_GNU
-// RUN: %clang_cc1 -triple x86_64-unknown-windows-msvc -w -o - -emit-llvm 
-fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_WIN
+// RUN: %clang_cc1 -Wno-error=incompatible-pointer-types -triple 
x86_64-unknown-unknown -w -o - -emit-llvm %s | FileCheck %s 
-check-prefix=NO__ERRNO
+// RUN: %clang_cc1 -Wno-error=incompatible-pointer-types -triple 
x86_64-unknown-unknown -w -o - -emit-llvm -fmath-errno %s | FileCheck %s 
-check-prefix=HAS_ERRNO
+// RUN: %clang_cc1 -Wno-error=incompatible-pointer-types -triple 
x86_64-unknown-unknown -w -o - -emit-llvm -disable-llvm-passes -O2 %s | 
FileCheck %s -check-prefix=NO__ERRNO
+// RUN: %clang_cc1 -Wno-error=incompatible-pointer-types -triple 
x86_64-unknown-unknown -w -o - -emit-llvm -disable-llvm-passes -O2 -fmath-errno 
%s | FileCheck %s -check-prefix=HAS_ERRNO
+// RUN: %clang_cc1 -Wno-error=incompatible-pointer-types -triple 
x86_64-unknown-unknown-gnu -w -o - -emit-llvm -fmath-errno %s | FileCheck %s 
--check-prefix=HAS_ERRNO_GNU
+// RUN: %clang_cc1 -Wno-error=incompatible-pointer-types -triple 
x86_64-unknown-windows-msvc -w -o - -emit-llvm -fmath-errno %s | FileCheck %s 
--check-prefix=HAS_ERRNO_WIN
 
 // Test attributes and codegen of math builtins.
 
diff --git a/clang/test/CodeGen/arm64-microsoft-intrinsics.c 
b/clang/test/CodeGen/arm64-microsoft-intrinsics.c
index 51e0038b64cde..c0ff785883c71 100644
--- a/clang/test/CodeGen/arm64-microsoft-intrinsics.c
+++ b/clang/test/CodeGen/arm64-microsoft-intrinsics.c
@@ -4,14 +4,21 @@
 // RUN: not %clang_cc1 -triple arm64-linux -Werror -S -o /dev/null %s 2>&1 \
 // RUN:    | FileCheck %s -check-prefix CHECK-LINUX
 
-// RUN: %clang_cc1 -triple arm64-darwin -Wno-implicit-function-declaration 
-fms-compatibility -emit-llvm -o - %s \
+// RUN: %clang_cc1 -triple arm64-darwin -Wno-implicit-function-declaration 
-fms-compatibility -emit-llvm -o - -DARM64_DARWIN %s \
 // RUN:    | FileCheck %s -check-prefix CHECK-MSCOMPAT
 
-long test_InterlockedAdd(long volatile *Addend, long Value) {
+// For some reason '_InterlockedAdd` on arm64-darwin takes an 'int*' rather 
than a 'long*'.
+#ifdef ARM64_DARWIN
+typedef int int32_t;
+#else
+typedef long int32_t;
+#endif
+
+long test_InterlockedAdd(int32_t volatile *Addend, long Value) {
   return _InterlockedAdd(Addend, Value);
 }
 
-long test_InterlockedAdd_constant(long volatile *Addend) {
+long test_InterlockedAdd_constant(int32_t volatile *Addend) {
   return _InterlockedAdd(Addend, -1);
 }
 
@@ -21,7 +28,7 @@ long test_InterlockedAdd_constant(long volatile *Addend) {
 // CHECK-MSVC: ret i32 %[[NEWVAL:[0-9]+]]
 // CHECK-LINUX: error: call to undeclared function '_InterlockedAdd'
 
-long test_InterlockedAdd_acq(long volatile *Addend, long Value) {
+long test_InterlockedAdd_acq(int32_t volatile *Addend, long Value) {
   return _InterlockedAdd_acq(Addend, Value);
 }
 
@@ -31,7 +38,7 @@ long test_InterlockedAdd_acq(long volatile *Addend, long 
Value) {
 // CHECK-MSVC: ret i32 %[[NEWVAL:[0-9]+]]
 // CHECK-LINUX: error: call to undeclared function '_InterlockedAdd_acq'
 
-long test_InterlockedAdd_nf(long volatile *Addend, long Value) {
+long test_InterlockedAdd_nf(int32_t volatile *Addend, long Value) {
   return _InterlockedAdd_nf(Addend, Value);
 }
 
@@ -41,7 +48,7 @@ long test_InterlockedAdd_nf(long volatile *Addend, long 
Value) {
 // CHECK-MSVC: ret i32 %[[NEWVAL:[0-9]+]]
 // CHECK-LINUX: error: call to undeclared function '_InterlockedAdd_nf'
 
-long test_InterlockedAdd_rel(long volatile *Addend, long Value) {
+long test_InterlockedAdd_rel(int32_t volatile *Addend, long Value) {
   return _InterlockedAdd_rel(Addend, Value);
 }
 
diff --git a/clang/test/CodeGen/builtin-rename.c 
b/clang/test/CodeGen/builtin-rename.c
index 0b71d88806237..0092e54ef37d9 100644
--- a/clang/test/CodeGen/builtin-rename.c
+++ b/clang/test/CodeGen/builtin-rename.c
@@ -4,5 +4,5 @@
 int printf(const char *, ...);
 
 int foo(void) {
-  return printf(printf);
+  return printf((const char*)printf);
 }
diff --git a/clang/test/CodeGen/ms-intrinsics-underaligned.c 
b/clang/test/CodeGen/ms-intrinsics-underaligned.c
index 34e2afb09f4b9..5be8ed8c6a600 100644
--- a/clang/test/CodeGen/ms-intrinsics-underaligned.c
+++ b/clang/test/CodeGen/ms-intrinsics-underaligned.c
@@ -111,6 +111,6 @@ long test_InterlockedAdd(X *x) {
 // CHECK-AARCH64-LABEL: @test_InterlockedAdd64(
 // CHECK-AARCH64:   atomicrmw {{.*}} align 8
 long test_InterlockedAdd64(X *x) {
-  return _InterlockedAdd64(&x->c, 4);
+  return _InterlockedAdd64((volatile long long*)&x->c, 4);
 }
 #endif
diff --git a/clang/test/CodeGen/ubsan-pass-object-size.c 
b/clang/test/CodeGen/ubsan-pass-object-size.c
index b36b8bb409aef..c606d33128322 100644
--- a/clang/test/CodeGen/ubsan-pass-object-size.c
+++ b/clang/test/CodeGen/ubsan-pass-object-size.c
@@ -14,7 +14,8 @@ int foo(int *const p __attribute__((pass_object_size(0))), 
int n) {
   // CHECK: __ubsan_handle_out_of_bounds
 
   {
-    int **p = &p; // Shadow the parameter. The pass_object_size info is lost.
+    int **q = &p;
+    int **p = q; // Shadow the parameter. The pass_object_size info is lost.
     // CHECK-NOT: __ubsan_handle_out_of_bounds
     x = *p[n];
   }
diff --git a/clang/test/CodeGen/vla.c b/clang/test/CodeGen/vla.c
index a22ba727df2fe..18aa744b5f6fe 100644
--- a/clang/test/CodeGen/vla.c
+++ b/clang/test/CodeGen/vla.c
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -Wno-int-conversion -triple i386-unknown-unknown %s 
-emit-llvm -o - | FileCheck %s -check-prefixes=CHECK,NULL-INVALID
-// RUN: %clang_cc1 -Wno-int-conversion -triple i386-unknown-unknown %s 
-emit-llvm -fno-delete-null-pointer-checks -o - | FileCheck %s 
-check-prefixes=CHECK,NULL-VALID
+// RUN: %clang_cc1 -Wno-error=incompatible-pointer-types -Wno-int-conversion 
-triple i386-unknown-unknown %s -emit-llvm -o - | File...
[truncated]

``````````

</details>


https://github.com/llvm/llvm-project/pull/157364
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to