This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch to add "nonnull" attribute to various builtins


This patch adds the "nonnull" attribute to most builtin functions
taking pointer parameters.  I'm not a language guru, but I believe
none of these should be expected to accept NULL pointers.

There were a few internal builtins of which I wasn't sure about
whether they should accept NULL, namely __builtin_return,
__builtin_setjmp, __builtin_longjmp and __builtin_eh_return.  If we
decide they should also use "nonnull", I can add that in a followup
patch.

Tested on sparc-sun-solaris2.7, no regressions and the new test
passes.

Ok for mainline?

		Thanks,
		--Kaveh


2003-05-01  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

gcc:
	* builtin-attrs.def (ATTR_NONNULL_1_2, ATTR_NONNULL_1_4,
	ATTR_CONST_NONNULL_1, ATTR_PURE_NONNULL_1, ATTR_MALLOC_NONNULL_1,
	ATTR_PURE_NONNULL_1_2): New.

	* builtins.def (DEF_EXT_FALLBACK_BUILTIN): Accept ATTRS argument.
	(BUILT_IN_BZERO, BUILT_IN_BCOPY, BUILT_IN_BCMP, BUILT_IN_INDEX,
	BUILT_IN_RINDEX, BUILT_IN_MEMCPY, BUILT_IN_MEMMOVE,
	BUILT_IN_MEMCMP, BUILT_IN_MEMSET, BUILT_IN_MEMPCPY,
	BUILT_IN_STRCAT, BUILT_IN_STRNCAT, BUILT_IN_STPCPY,
	BUILT_IN_STRCPY, BUILT_IN_STRNCPY, BUILT_IN_STRCMP,
	BUILT_IN_STRNCMP, BUILT_IN_STRLEN, BUILT_IN_STRSTR,
	BUILT_IN_STRPBRK, BUILT_IN_STRSPN, BUILT_IN_STRCSPN,
	BUILT_IN_STRCHR, BUILT_IN_STRRCHR, BUILT_IN_NAN, BUILT_IN_NANF,
	BUILT_IN_NANL, BUILT_IN_NANS, BUILT_IN_NANSF, BUILT_IN_NANSL,
	BUILT_IN_PUTS, BUILT_IN_FPUTC, BUILT_IN_FPUTS, BUILT_IN_FWRITE,
	BUILT_IN_PUTS_UNLOCKED, BUILT_IN_FPUTC_UNLOCKED,
	BUILT_IN_FPUTS_UNLOCKED, BUILT_IN_FWRITE_UNLOCKED,
	BUILT_IN_STRDUP): Add "nonnull" attribute.

testsuite:
	* gcc.dg/nonnull-3.c: New test.

diff -rup orig/egcc-CVS20030501/gcc/builtin-attrs.def egcc-CVS20030501/gcc/builtin-attrs.def
--- orig/egcc-CVS20030501/gcc/builtin-attrs.def	2003-03-02 00:55:15.000000000 -0500
+++ egcc-CVS20030501/gcc/builtin-attrs.def	2003-05-02 16:41:46.782639916 -0400
@@ -108,6 +108,24 @@ DEF_ATTR_TREE_LIST (ATTR_NONNULL_2, ATTR
 			ATTR_NOTHROW_LIST)
 DEF_ATTR_TREE_LIST (ATTR_NONNULL_3, ATTR_NONNULL, ATTR_LIST_3, \
 			ATTR_NOTHROW_LIST)
+/* Nothrow functions whose first and second parameters are nonnull pointers. */
+DEF_ATTR_TREE_LIST (ATTR_NONNULL_1_2, ATTR_NONNULL, ATTR_LIST_2, \
+			ATTR_NONNULL_1)
+/* Nothrow functions whose first and fourth parameters are nonnull pointers. */
+DEF_ATTR_TREE_LIST (ATTR_NONNULL_1_4, ATTR_NONNULL, ATTR_LIST_4, \
+			ATTR_NONNULL_1)
+/* Nothrow const functions whose first parameter is a nonnull pointer. */
+DEF_ATTR_TREE_LIST (ATTR_CONST_NONNULL_1, ATTR_CONST, ATTR_NULL, \
+			ATTR_NONNULL_1)
+/* Nothrow pure functions whose first parameter is a nonnull pointer. */
+DEF_ATTR_TREE_LIST (ATTR_PURE_NONNULL_1, ATTR_PURE, ATTR_NULL, \
+			ATTR_NONNULL_1)
+/* Nothrow pure functions whose first and second parameters are nonnull pointers. */
+DEF_ATTR_TREE_LIST (ATTR_PURE_NONNULL_1_2, ATTR_PURE, ATTR_NULL, \
+			ATTR_NONNULL_1_2)
+/* Nothrow malloc functions whose first parameter is a nonnull pointer. */
+DEF_ATTR_TREE_LIST (ATTR_MALLOC_NONNULL_1, ATTR_MALLOC, ATTR_NULL, \
+			ATTR_NONNULL_1)
 
 /* Construct a tree for a format attribute.  */
 #define DEF_FORMAT_ATTRIBUTE(TYPE, FA, VALUES)				 \
diff -rup orig/egcc-CVS20030501/gcc/builtins.def egcc-CVS20030501/gcc/builtins.def
--- orig/egcc-CVS20030501/gcc/builtins.def	2003-05-01 21:01:14.000000000 -0400
+++ egcc-CVS20030501/gcc/builtins.def	2003-05-02 16:39:15.147878993 -0400
@@ -85,9 +85,9 @@ Software Foundation, 59 Temple Place - S
    we ignore the version of these builtins that does not begin with
    __builtin.  */
 #undef DEF_EXT_FALLBACK_BUILTIN
-#define DEF_EXT_FALLBACK_BUILTIN(ENUM, NAME, TYPE)	\
+#define DEF_EXT_FALLBACK_BUILTIN(ENUM, NAME, TYPE, ATTRS)	\
   DEF_BUILTIN (ENUM, NAME, BUILT_IN_NORMAL, TYPE, TYPE,	\
-	       false, true, true, ATTR_NOTHROW_LIST, true)
+	       false, true, true, ATTRS, true)
 
 /* A library builtin (like __builtin_strchr) is a builtin equivalent
    of an ANSI/ISO standard library function.  In addition to the
@@ -295,21 +295,21 @@ DEF_BUILTIN (BUILT_IN_BZERO,
 	     BT_FN_VOID_PTR_SIZE, 
 	     BT_FN_VOID_VAR,
 	     true, true, true,
-	     ATTR_NOTHROW_LIST, false)
+	     ATTR_NONNULL_1, false)
 DEF_BUILTIN (BUILT_IN_BCOPY,
 	     "__builtin_bcopy",
 	     BUILT_IN_NORMAL,
 	     BT_FN_VOID_CONST_PTR_PTR_SIZE, 
 	     BT_FN_VOID_VAR,
 	     true, true, true,
-	     ATTR_NOTHROW_LIST, false)
+	     ATTR_NONNULL_1_2, false)
 DEF_BUILTIN (BUILT_IN_BCMP,
 	     "__builtin_bcmp",
 	     BUILT_IN_NORMAL,
 	     BT_FN_INT_CONST_PTR_CONST_PTR_SIZE,
 	     BT_FN_INT_VAR,
 	     true, true, true,
-	     ATTR_PURE_NOTHROW_LIST, false)
+	     ATTR_PURE_NONNULL_1_2, false)
 
 DEF_EXT_LIB_BUILTIN(BUILT_IN_FFS,
 		    "__builtin_ffs",
@@ -377,89 +377,89 @@ DEF_GCC_BUILTIN(BUILT_IN_PARITYLL,
 DEF_EXT_LIB_BUILTIN(BUILT_IN_INDEX,
 		    "__builtin_index",
 		    BT_FN_STRING_CONST_STRING_INT,
-		    ATTR_PURE_NOTHROW_LIST)
+		    ATTR_PURE_NONNULL_1)
 DEF_EXT_LIB_BUILTIN(BUILT_IN_RINDEX,
 		    "__builtin_rindex",
 		    BT_FN_STRING_CONST_STRING_INT,
-		    ATTR_PURE_NOTHROW_LIST)
+		    ATTR_PURE_NONNULL_1)
 
 DEF_LIB_BUILTIN(BUILT_IN_MEMCPY,
 		"__builtin_memcpy",
 		BT_FN_PTR_PTR_CONST_PTR_SIZE,
-		ATTR_NOTHROW_LIST)
+		ATTR_NONNULL_1_2)
 DEF_LIB_BUILTIN(BUILT_IN_MEMMOVE,
 		"__builtin_memmove",
 		BT_FN_PTR_PTR_CONST_PTR_SIZE,
-		ATTR_NOTHROW_LIST)
+		ATTR_NONNULL_1_2)
 DEF_LIB_BUILTIN(BUILT_IN_MEMCMP,
 		"__builtin_memcmp",
 		BT_FN_INT_CONST_PTR_CONST_PTR_SIZE,
-		ATTR_PURE_NOTHROW_LIST)
+		ATTR_PURE_NONNULL_1_2)
 DEF_LIB_BUILTIN(BUILT_IN_MEMSET,
 		"__builtin_memset",
 		BT_FN_PTR_PTR_INT_SIZE,
-		ATTR_NOTHROW_LIST)
+		ATTR_NONNULL_1)
 DEF_EXT_LIB_BUILTIN(BUILT_IN_MEMPCPY,
 		"__builtin_mempcpy",
 		BT_FN_PTR_PTR_CONST_PTR_SIZE,
-		ATTR_NOTHROW_LIST)
+		ATTR_NONNULL_1_2)
 
 DEF_LIB_BUILTIN(BUILT_IN_STRCAT,
 		"__builtin_strcat",
 		BT_FN_STRING_STRING_CONST_STRING,
-		ATTR_NOTHROW_LIST)
+		ATTR_NONNULL_1_2)
 DEF_LIB_BUILTIN(BUILT_IN_STRNCAT,
 		"__builtin_strncat",
 		BT_FN_STRING_STRING_CONST_STRING_SIZE,
-		ATTR_NOTHROW_LIST)
+		ATTR_NONNULL_1_2)
 DEF_EXT_LIB_BUILTIN(BUILT_IN_STPCPY,
 		"__builtin_stpcpy",
 		BT_FN_STRING_STRING_CONST_STRING,
-		ATTR_NOTHROW_LIST)
+		ATTR_NONNULL_1_2)
 DEF_LIB_BUILTIN(BUILT_IN_STRCPY,
 		"__builtin_strcpy",
 		BT_FN_STRING_STRING_CONST_STRING,
-		ATTR_NOTHROW_LIST)
+		ATTR_NONNULL_1_2)
 DEF_LIB_BUILTIN(BUILT_IN_STRNCPY,
 		"__builtin_strncpy",
 		BT_FN_STRING_STRING_CONST_STRING_SIZE,
-		ATTR_NOTHROW_LIST)
+		ATTR_NONNULL_1_2)
 DEF_LIB_BUILTIN(BUILT_IN_STRCMP,
 		"__builtin_strcmp",
 		BT_FN_INT_CONST_STRING_CONST_STRING,
-		ATTR_PURE_NOTHROW_LIST)
+		ATTR_PURE_NONNULL_1_2)
 DEF_LIB_BUILTIN(BUILT_IN_STRNCMP,
 		"__builtin_strncmp",
 		BT_FN_INT_CONST_STRING_CONST_STRING_SIZE,
-		ATTR_PURE_NOTHROW_LIST)
+		ATTR_PURE_NONNULL_1_2)
 DEF_LIB_BUILTIN(BUILT_IN_STRLEN,
 		"__builtin_strlen",
 		BT_FN_SIZE_CONST_STRING,
-		ATTR_PURE_NOTHROW_LIST)
+		ATTR_PURE_NONNULL_1)
 DEF_LIB_BUILTIN(BUILT_IN_STRSTR,
 		"__builtin_strstr",
 		BT_FN_STRING_CONST_STRING_CONST_STRING,
-		ATTR_PURE_NOTHROW_LIST)
+		ATTR_PURE_NONNULL_1_2)
 DEF_LIB_BUILTIN(BUILT_IN_STRPBRK,
 		"__builtin_strpbrk",
 		BT_FN_STRING_CONST_STRING_CONST_STRING,
-		ATTR_PURE_NOTHROW_LIST)
+		ATTR_PURE_NONNULL_1_2)
 DEF_LIB_BUILTIN(BUILT_IN_STRSPN,
 		"__builtin_strspn",
 		BT_FN_SIZE_CONST_STRING_CONST_STRING,
-		ATTR_PURE_NOTHROW_LIST)
+		ATTR_PURE_NONNULL_1_2)
 DEF_LIB_BUILTIN(BUILT_IN_STRCSPN,
 		"__builtin_strcspn",
 		BT_FN_SIZE_CONST_STRING_CONST_STRING,
-		ATTR_PURE_NOTHROW_LIST)
+		ATTR_PURE_NONNULL_1_2)
 DEF_LIB_BUILTIN(BUILT_IN_STRCHR,
 		"__builtin_strchr",
 		BT_FN_STRING_CONST_STRING_INT,
-		ATTR_PURE_NOTHROW_LIST)
+		ATTR_PURE_NONNULL_1)
 DEF_LIB_BUILTIN(BUILT_IN_STRRCHR,
 		"__builtin_strrchr",
 		BT_FN_STRING_CONST_STRING_INT,
-		ATTR_PURE_NOTHROW_LIST)
+		ATTR_PURE_NONNULL_1)
 
 DEF_LIB_BUILTIN(BUILT_IN_SQRT,
 		"__builtin_sqrt",
@@ -647,28 +647,28 @@ DEF_GCC_BUILTIN(BUILT_IN_HUGE_VALL,
 DEF_LIB_BUILTIN(BUILT_IN_NAN,
 		"__builtin_nan",
 		BT_FN_DOUBLE_CONST_STRING,
-		ATTR_CONST_NOTHROW_LIST)
+		ATTR_CONST_NONNULL_1)
 DEF_LIB_BUILTIN(BUILT_IN_NANF,
 		"__builtin_nanf",
 		BT_FN_FLOAT_CONST_STRING,
-		ATTR_CONST_NOTHROW_LIST)
+		ATTR_CONST_NONNULL_1)
 DEF_LIB_BUILTIN(BUILT_IN_NANL,
 		"__builtin_nanl",
 		BT_FN_LONG_DOUBLE_CONST_STRING,
-		ATTR_CONST_NOTHROW_LIST)
+		ATTR_CONST_NONNULL_1)
 
 DEF_LIB_BUILTIN(BUILT_IN_NANS,
 		"__builtin_nans",
 		BT_FN_DOUBLE_CONST_STRING,
-		ATTR_CONST_NOTHROW_LIST)
+		ATTR_CONST_NONNULL_1)
 DEF_LIB_BUILTIN(BUILT_IN_NANSF,
 		"__builtin_nansf",
 		BT_FN_FLOAT_CONST_STRING,
-		ATTR_CONST_NOTHROW_LIST)
+		ATTR_CONST_NONNULL_1)
 DEF_LIB_BUILTIN(BUILT_IN_NANSL,
 		"__builtin_nansl",
 		BT_FN_LONG_DOUBLE_CONST_STRING,
-		ATTR_CONST_NOTHROW_LIST)
+		ATTR_CONST_NONNULL_1)
 
 DEF_GCC_BUILTIN(BUILT_IN_SAVEREGS,
 		"__builtin_saveregs",
@@ -744,7 +744,7 @@ DEF_LIB_BUILTIN(BUILT_IN_PUTCHAR,
 DEF_LIB_BUILTIN(BUILT_IN_PUTS,
 		"__builtin_puts",
 		BT_FN_INT_CONST_STRING,
-		ATTR_NOTHROW_LIST)
+		ATTR_NONNULL_1)
 DEF_C99_BUILTIN(BUILT_IN_SNPRINTF,
 		"__builtin_snprintf",
 		BT_FN_INT_STRING_SIZE_CONST_STRING_VAR,
@@ -793,17 +793,17 @@ DEF_LIB_BUILTIN(BUILT_IN_VSPRINTF,
 DEF_FALLBACK_BUILTIN(BUILT_IN_FPUTC,
 		     "__builtin_fputc",
 		     BT_FN_INT_INT_PTR,
-		     ATTR_NOTHROW_LIST)
+		     ATTR_NONNULL_2)
 DEF_BUILTIN (BUILT_IN_FPUTS,
 	     "__builtin_fputs",
 	     BUILT_IN_NORMAL,
 	     BT_FN_INT_CONST_STRING_PTR,
 	     BT_FN_INT_VAR,
-	     true, true, false, ATTR_NOTHROW_LIST, true)
+	     true, true, false, ATTR_NONNULL_1_2, true)
 DEF_FALLBACK_BUILTIN(BUILT_IN_FWRITE,
 		     "__builtin_fwrite",
 		     BT_FN_SIZE_CONST_PTR_SIZE_SIZE_PTR,
-		      ATTR_NOTHROW_LIST)
+		      ATTR_NONNULL_1_4)
 DEF_FRONT_END_LIB_BUILTIN(BUILT_IN_FPRINTF,
 			 "__builtin_fprintf",
 			 BT_FN_INT_PTR_CONST_STRING_VAR,
@@ -813,10 +813,10 @@ DEF_FRONT_END_LIB_BUILTIN(BUILT_IN_FPRIN
 
 DEF_EXT_FALLBACK_BUILTIN(BUILT_IN_PUTCHAR_UNLOCKED,
 			 "__builtin_putchar_unlocked",
-			 BT_FN_INT_INT)
+			 BT_FN_INT_INT, ATTR_NOTHROW_LIST)
 DEF_EXT_FALLBACK_BUILTIN(BUILT_IN_PUTS_UNLOCKED,
 			 "__builtin_puts_unlocked",
-			 BT_FN_INT_CONST_STRING)
+			 BT_FN_INT_CONST_STRING, ATTR_NONNULL_1)
 DEF_EXT_FRONT_END_LIB_BUILTIN(BUILT_IN_PRINTF_UNLOCKED,
 			      "__builtin_printf_unlocked",
 			      BT_FN_INT_CONST_STRING_VAR,
@@ -831,16 +831,16 @@ DEF_EXT_FRONT_END_LIB_BUILTIN(BUILT_IN_P
 
 DEF_EXT_FALLBACK_BUILTIN(BUILT_IN_FPUTC_UNLOCKED,
 			 "__builtin_fputc_unlocked",
-			 BT_FN_INT_INT_PTR)
+			 BT_FN_INT_INT_PTR, ATTR_NONNULL_2)
 DEF_BUILTIN (BUILT_IN_FPUTS_UNLOCKED,
 	     "__builtin_fputs_unlocked",
 	     BUILT_IN_NORMAL,
 	     BT_FN_INT_CONST_STRING_PTR,
 	     BT_FN_INT_VAR,
-	     true, true, true, ATTR_NOTHROW_LIST, true)
+	     true, true, true, ATTR_NONNULL_1_2, true)
 DEF_EXT_FALLBACK_BUILTIN(BUILT_IN_FWRITE_UNLOCKED,
 			 "__builtin_fwrite_unlocked",
-			 BT_FN_SIZE_CONST_PTR_SIZE_SIZE_PTR)
+			 BT_FN_SIZE_CONST_PTR_SIZE_SIZE_PTR, ATTR_NONNULL_1_4)
 DEF_EXT_FRONT_END_LIB_BUILTIN(BUILT_IN_FPRINTF_UNLOCKED,
 			      "__builtin_fprintf_unlocked",
 			      BT_FN_INT_PTR_CONST_STRING_VAR,
@@ -961,5 +961,5 @@ DEF_LIB_BUILTIN(BUILT_IN_CALLOC,
 DEF_EXT_LIB_BUILTIN(BUILT_IN_STRDUP,
 		    "__builtin_strdup",
 		    BT_FN_STRING_CONST_STRING,
-		    ATTR_MALLOC_NOTHROW_LIST)
+		    ATTR_MALLOC_NONNULL_1)
 
diff -rup orig/egcc-CVS20030501/gcc/testsuite/gcc.dg/nonnull-3.c egcc-CVS20030501/gcc/testsuite/gcc.dg/nonnull-3.c
--- orig/egcc-CVS20030501/gcc/testsuite/gcc.dg/nonnull-3.c	2003-05-02 16:39:31.478408938 -0400
+++ egcc-CVS20030501/gcc/testsuite/gcc.dg/nonnull-3.c	2003-05-02 16:39:15.147878993 -0400
@@ -0,0 +1,75 @@
+/* Test for the "nonnull" function attribute on builtins.  Use the
+   "__builtin_" style below so we don't need prototypes.  */
+/* Origin: Kaveh R. Ghazi <ghazi@caip.rutgers.edu> */
+/* { dg-do compile } */
+/* { dg-options "-Wnonnull" } */
+
+#include <stddef.h>
+
+void
+foo (void *p, char *s)
+{
+  __builtin_bzero (NULL, 16);  /* { dg-warning "null" "null pointer check" } */
+  __builtin_bcopy (NULL, p, 16);  /* { dg-warning "null" "null pointer check" } */
+  __builtin_bcopy (p, NULL, 16);  /* { dg-warning "null" "null pointer check" } */
+  __builtin_bcmp (NULL, p, 16);  /* { dg-warning "null" "null pointer check" } */
+  __builtin_bcmp (p, NULL, 16);  /* { dg-warning "null" "null pointer check" } */
+  __builtin_index (NULL, 16);  /* { dg-warning "null" "null pointer check" } */
+  __builtin_rindex (NULL, 16);  /* { dg-warning "null" "null pointer check" } */
+
+  __builtin_memcpy (p, NULL, 16);  /* { dg-warning "null" "null pointer check" } */
+  __builtin_memcpy (NULL, p, 16);  /* { dg-warning "null" "null pointer check" } */
+  __builtin_memmove (p, NULL, 16);  /* { dg-warning "null" "null pointer check" } */
+  __builtin_memmove (NULL, p, 16);  /* { dg-warning "null" "null pointer check" } */
+  __builtin_memcmp (p, NULL, 16);  /* { dg-warning "null" "null pointer check" } */
+  __builtin_memcmp (NULL, p, 16);  /* { dg-warning "null" "null pointer check" } */
+  __builtin_memset (NULL, 0, 16);  /* { dg-warning "null" "null pointer check" } */
+  __builtin_mempcpy (p, NULL, 16);  /* { dg-warning "null" "null pointer check" } */
+  __builtin_mempcpy (NULL, p, 16);  /* { dg-warning "null" "null pointer check" } */
+
+  __builtin_strcat (NULL, s);  /* { dg-warning "null" "null pointer check" } */
+  __builtin_strcat (s, NULL);  /* { dg-warning "null" "null pointer check" } */
+  __builtin_strncat (NULL, s, 16);  /* { dg-warning "null" "null pointer check" } */
+  __builtin_strncat (s, NULL, 16);  /* { dg-warning "null" "null pointer check" } */
+  __builtin_stpcpy (NULL, s);  /* { dg-warning "null" "null pointer check" } */
+  __builtin_stpcpy (s, NULL);  /* { dg-warning "null" "null pointer check" } */
+  __builtin_strcpy (NULL, s);  /* { dg-warning "null" "null pointer check" } */
+  __builtin_strcpy (s, NULL);  /* { dg-warning "null" "null pointer check" } */
+  __builtin_strncpy (NULL, s, 16);  /* { dg-warning "null" "null pointer check" } */
+  __builtin_strncpy (s, NULL, 16);  /* { dg-warning "null" "null pointer check" } */
+  __builtin_strcmp (NULL, s);  /* { dg-warning "null" "null pointer check" } */
+  __builtin_strcmp (s, NULL);  /* { dg-warning "null" "null pointer check" } */
+  __builtin_strncmp (NULL, s, 16);  /* { dg-warning "null" "null pointer check" } */
+  __builtin_strncmp (s, NULL, 16);  /* { dg-warning "null" "null pointer check" } */
+  __builtin_strlen (NULL);  /* { dg-warning "null" "null pointer check" } */
+  __builtin_strstr (NULL, s);  /* { dg-warning "null" "null pointer check" } */
+  __builtin_strstr (s, NULL);  /* { dg-warning "null" "null pointer check" } */
+  __builtin_strpbrk (NULL, s);  /* { dg-warning "null" "null pointer check" } */
+  __builtin_strpbrk (s, NULL);  /* { dg-warning "null" "null pointer check" } */
+  __builtin_strspn (NULL, s);  /* { dg-warning "null" "null pointer check" } */
+  __builtin_strspn (s, NULL);  /* { dg-warning "null" "null pointer check" } */
+  __builtin_strchr (NULL, 16);  /* { dg-warning "null" "null pointer check" } */
+  __builtin_strrchr (NULL, 16);  /* { dg-warning "null" "null pointer check" } */
+  __builtin_strdup (NULL);  /* { dg-warning "null" "null pointer check" } */
+
+  __builtin_nan (NULL);  /* { dg-warning "null" "null pointer check" } */
+  __builtin_nanf (NULL);  /* { dg-warning "null" "null pointer check" } */
+  __builtin_nanl (NULL);  /* { dg-warning "null" "null pointer check" } */
+  __builtin_nans (NULL);  /* { dg-warning "null" "null pointer check" } */
+  __builtin_nansf (NULL);  /* { dg-warning "null" "null pointer check" } */
+  __builtin_nansl (NULL);  /* { dg-warning "null" "null pointer check" } */
+
+  __builtin_puts (NULL);  /* { dg-warning "null" "null pointer check" } */
+  __builtin_fputc (*s, NULL);  /* { dg-warning "null" "null pointer check" } */
+  __builtin_fputs (s, NULL);  /* { dg-warning "null" "null pointer check" } */
+  __builtin_fputs (NULL, p);  /* { dg-warning "null" "null pointer check" } */
+  __builtin_fwrite (s, 16, 16, NULL);  /* { dg-warning "null" "null pointer check" } */
+  __builtin_fwrite (NULL, 16, 16, p);  /* { dg-warning "null" "null pointer check" } */
+  __builtin_puts_unlocked (NULL);  /* { dg-warning "null" "null pointer check" } */
+  __builtin_fputc_unlocked (*s, NULL);  /* { dg-warning "null" "null pointer check" } */
+  __builtin_fputs_unlocked (s, NULL);  /* { dg-warning "null" "null pointer check" } */
+  __builtin_fputs_unlocked (NULL, p);  /* { dg-warning "null" "null pointer check" } */
+  __builtin_fwrite_unlocked (s, 16, 16, NULL);  /* { dg-warning "null" "null pointer check" } */
+  __builtin_fwrite_unlocked (NULL, 16, 16, p);  /* { dg-warning "null" "null pointer check" } */
+
+}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]