@@ -5783,6 +5783,7 @@ check_function_sentinel (const_tree fnty
sentinel = fold_for_warn (argarray[nargs - 1 - pos]);
if ((!POINTER_TYPE_P (TREE_TYPE (sentinel))
|| !integer_zerop (sentinel))
+ && TREE_CODE (TREE_TYPE (sentinel)) != NULLPTR_TYPE
/* Although __null (in C++) is only an integer we allow it
nevertheless, as we are guaranteed that it's exactly
as wide as a pointer, and we don't want to force
@@ -0,0 +1,21 @@
+/* PR c/114780 */
+/* { dg-do compile } */
+/* { dg-options "-std=c23 -Wformat" } */
+
+#include <stddef.h>
+
+[[gnu::sentinel]] void foo (int, ...);
+[[gnu::sentinel]] void bar (...);
+
+void
+baz (nullptr_t p)
+{
+ foo (1, 2, nullptr);
+ foo (3, 4, 5, p);
+ bar (nullptr);
+ bar (p);
+ foo (6, 7, 0); // { dg-warning "missing sentinel in function call" }
+ bar (0); // { dg-warning "missing sentinel in function call" }
+ foo (8, 9, NULL);
+ bar (NULL);
+}