[PATCH/testsuite] avoid test failures with -fpic

Message ID 5852525a-f505-6b43-ff7e-d8aa5d34f352@gmail.com
State New
Headers show
Series
  • [PATCH/testsuite] avoid test failures with -fpic
Related show

Commit Message

Martin Sebor Feb. 26, 2018, 11:47 p.m.
Compiling a number of tests with -fpic results in failures
because the tests make use of non-inline, extern helper
functions defined within, and these helpers must be assumed
to have been superimposed elsewhere.

For example:
https://gcc.gnu.org/ml/gcc-testresults/2018-02/msg01762.html

I took a quick pass through the failures and declared
the helpers static to avoid them.  I only did this in failure
tests I recognized because I introduced them myself being unaware
that building the tests with -fpic was expected to work.

This should make the -fpic test results a lot cleaner than
they currently are, although I don't think it brings them
up to par with non-fpic results.

Unless there are objections in the next day or so I'll commit
the fixes as obvious.

Martin

Comments

Jeff Law Feb. 28, 2018, 1:37 a.m. | #1
On 02/26/2018 04:47 PM, Martin Sebor wrote:
> Compiling a number of tests with -fpic results in failures

> because the tests make use of non-inline, extern helper

> functions defined within, and these helpers must be assumed

> to have been superimposed elsewhere.

> 

> For example:

> https://gcc.gnu.org/ml/gcc-testresults/2018-02/msg01762.html

> 

> I took a quick pass through the failures and declared

> the helpers static to avoid them.  I only did this in failure

> tests I recognized because I introduced them myself being unaware

> that building the tests with -fpic was expected to work.

> 

> This should make the -fpic test results a lot cleaner than

> they currently are, although I don't think it brings them

> up to par with non-fpic results.

> 

> Unless there are objections in the next day or so I'll commit

> the fixes as obvious.

OK.


jeff

Patch

gcc/testsuite/ChangeLog:

	* c-c++-common/Warray-bounds-2.c: Declare helper static to avoid
	-fpic test failures.
	* c-c++-common/Wrestrict-2.c: Same.
	* c-c++-common/Wstringop-truncation.c: Same.
	* gcc.dg/Warray-bounds-22.c: Same.
	* gcc.dg/Wstringop-overflow.c: Same.
	* gcc.dg/attr-alloc_size-3.c (unsigned_range): Same.
	(signed_range): Same.
	(unsigned_anti_range): Same.
	* gcc.dg/attr-alloc_size-4.c (unsigned_range): Same.
	(signed_range): Same.
	(unsigned_anti_range): Same.
	* gcc.dg/attr-alloc_size-7.c: Same.
	* gcc.dg/attr-alloc_size-8.c: Same.
	* gcc.dg/builtin-alloc-size.c: Same.
	* gcc.dg/builtin-stpncpy.c: Same.
	* gcc.dg/builtins-nonnull.c: Same.
	* gcc.dg/nonnull-4.c (g16_1_3_5_7_11_13): Same.
	* gcc.dg/pr79214.c: Same.
	* gcc.dg/tree-ssa/builtin-snprintf-warn-1.c: Same.
	* gcc.dg/tree-ssa/builtin-snprintf-warn-2.c: Same.
	* gcc.dg/tree-ssa/builtin-sprintf-5.c: Same.
	* gcc.dg/tree-ssa/builtin-sprintf-warn-11.c: Same.
	* gcc.dg/tree-ssa/builtin-sprintf-warn-12.c: Same.
	* gcc.dg/tree-ssa/builtin-sprintf-warn-13.c: Same.
	* gcc.dg/tree-ssa/builtin-sprintf-warn-14.c: Same.
	* gcc.dg/tree-ssa/builtin-sprintf-warn-15.c: Same.
	* gcc.dg/tree-ssa/builtin-sprintf-warn-19.c: Same.
	* gcc.dg/tree-ssa/builtin-sprintf-warn-3.c: Same.
	* gcc.dg/tree-ssa/builtin-sprintf-warn-9.c: Same.


diff --git a/gcc/testsuite/c-c++-common/Warray-bounds-2.c b/gcc/testsuite/c-c++-common/Warray-bounds-2.c
index becb3d4..db05f04 100644
--- a/gcc/testsuite/c-c++-common/Warray-bounds-2.c
+++ b/gcc/testsuite/c-c++-common/Warray-bounds-2.c
@@ -24,7 +24,8 @@  struct __attribute__ ((packed)) Array
 
 /* Exercise memcpy out-of-bounds offsets with an array of known size.  */
 
-void wrap_memcpy_src_xsize (char *d, const char *s, ptrdiff_t i, size_t n)
+static void
+wrap_memcpy_src_xsize (char *d, const char *s, ptrdiff_t i, size_t n)
 {
   memcpy (d, s + i, n);   /* { dg-warning "offset 46 is out of the bounds \\\[0, 45] of object .ar. with type .(struct )?Array." "memcpy" } */
 }
@@ -39,7 +40,8 @@  void call_memcpy_src_xsize (char *d, size_t n)
 
 /* Exercise memcpy out-of-bounds offsets with an array of unknown size.  */
 
-void wrap_memcpy_src_diff_max (char *d, const char *s, ptrdiff_t i, size_t n)
+static void
+wrap_memcpy_src_diff_max (char *d, const char *s, ptrdiff_t i, size_t n)
 {
   memcpy (d, s + i, n);   /* { dg-warning "pointer overflow between offset \[0-9\]+ and size 3" "memcpy" } */
 }
@@ -49,7 +51,8 @@  void call_memcpy_src_diff_max (char *d, const char *s, size_t n)
   wrap_memcpy_src_diff_max (d, s, MAX, 3);
 }
 
-void wrap_memcpy_dst_xsize (char *d, const char *s, ptrdiff_t i, size_t n)
+static void
+wrap_memcpy_dst_xsize (char *d, const char *s, ptrdiff_t i, size_t n)
 {
   memcpy (d + i, s, n);   /* { dg-warning "offset 47 is out of the bounds \\\[0, 45] of object .ar1. with type .(struct )?Array." "memcpy" } */
 }
@@ -62,7 +65,8 @@  void call_memcpy_dst_xsize (const char *s, size_t n)
   sink (&ar1);
 }
 
-void wrap_memcpy_dst_diff_max (char *d, const char *s, ptrdiff_t i, size_t n)
+static void
+wrap_memcpy_dst_diff_max (char *d, const char *s, ptrdiff_t i, size_t n)
 {
   memcpy (d + i, s, n);   /* { dg-warning "offset -?\[0-9\]+ is out of the bounds \\\[0, 45] of object .ar2. with type .(struct )?Array." "memcpy" } */
 }
@@ -76,7 +80,7 @@  void call_memcpy_dst_diff_max (const char *s, size_t n)
 }
 
 
-void wrap_strcat_src_xsize (char *d, const char *s, ptrdiff_t i)
+static void wrap_strcat_src_xsize (char *d, const char *s, ptrdiff_t i)
 {
   strcat (d, s + i);   /* { dg-warning "offset 46 is out of the bounds \\\[0, 45] of object .ar3. with type .(struct )?Array." "strcat" } */
 }
@@ -89,7 +93,7 @@  void call_strcat_src_xsize (char *d)
   sink (&ar3);
 }
 
-void wrap_strcat_dst_xsize (char *d, const char *s, ptrdiff_t i)
+static void wrap_strcat_dst_xsize (char *d, const char *s, ptrdiff_t i)
 {
   strcat (d + i, s);   /* { dg-warning "offset 47 is out of the bounds \\\[0, 45] of object .ar4. with type .(struct )?Array." "strcat" } */
 }
@@ -103,7 +107,7 @@  void call_strcat_dst_xsize (const char *s)
 }
 
 
-void wrap_strcpy_src_xsize (char *d, const char *s, ptrdiff_t i)
+static void wrap_strcpy_src_xsize (char *d, const char *s, ptrdiff_t i)
 {
   strcpy (d, s + i);   /* { dg-warning "offset 48 is out of the bounds \\\[0, 45] of object .ar5. with type .(struct )?Array." "strcpy" } */
 }
@@ -116,7 +120,7 @@  void call_strcpy_src_xsize (char *d)
   sink (&ar5);
 }
 
-void wrap_strcpy_dst_xsize (char *d, const char *s, ptrdiff_t i)
+static void wrap_strcpy_dst_xsize (char *d, const char *s, ptrdiff_t i)
 {
   strcpy (d + i, s);   /* { dg-warning "offset 49 is out of the bounds \\\[0, 45] of object .ar6. with type .(struct )?Array." "strcpy" } */
 }
@@ -132,7 +136,8 @@  void call_strcpy_dst_xsize (const char *s)
 
 /* Exercise strncpy out-of-bounds offsets with an array of known size.  */
 
-void wrap_strncpy_src_xsize (char *d, const char *s, ptrdiff_t i, size_t n)
+static void
+wrap_strncpy_src_xsize (char *d, const char *s, ptrdiff_t i, size_t n)
 {
   strncpy (d, s + i, n);   /* { dg-warning "offset 46 is out of the bounds \\\[0, 45] of object .ar7. with type '(struct )?Array." "strncpy" } */
 }
@@ -147,7 +152,8 @@  void call_strncpy_src_xsize (char *d, size_t n)
 
 /* Exercise strncpy out-of-bounds offsets with an array of unknown size.  */
 
-void wrap_strncpy_src_diff_max (char *d, const char *s, ptrdiff_t i, size_t n)
+static void
+wrap_strncpy_src_diff_max (char *d, const char *s, ptrdiff_t i, size_t n)
 {
   /* Unlike in the similar call to memcpy(), there is no pointer
      overflow here because the size N is not added to the source
@@ -160,7 +166,8 @@  void call_strncpy_src_diff_max (char *d, const char *s, size_t n)
   wrap_strncpy_src_diff_max (d, s, MAX, 3);
 }
 
-void wrap_strncpy_dst_xsize (char *d, const char *s, ptrdiff_t i, size_t n)
+static void
+wrap_strncpy_dst_xsize (char *d, const char *s, ptrdiff_t i, size_t n)
 {
   strncpy (d + i, s, n);   /* { dg-warning "offset 47 is out of the bounds \\\[0, 45] of object .ar8. with type .(struct )?Array." "strncpy" } */
 }
@@ -173,21 +180,22 @@  void call_strncpy_dst_xsize (const char *s, size_t n)
   sink (&ar8);
 }
 
-void wrap_strncpy_dst_diff_max (char *d, const char *s, ptrdiff_t i, size_t n)
+static void
+wrap_strncpy_dst_diff_max (char *d, const char *s, ptrdiff_t i, size_t n)
 {
   strncpy (d + i, s, n);   /* { dg-warning "offset -\[0-9\]+ is out of the bounds \\\[0, 45] of object .ar9. with type .(struct )?Array." "strncpy" } */
 }
 
 void call_strncpy_dst_diff_max (const char *s, size_t n)
 {
-  struct Array ar9;       /* { dg-message ".ar9. declared here" } */
+  struct Array ar9;       /* { dg-message ".ar9. declared here" "strncpy" } */
   sink (&ar9);
   wrap_strncpy_dst_diff_max (ar9.a17, s, MAX, n);
   sink (&ar9);
 }
 
-void wrap_strncpy_dstarray_diff_neg (char *d, const char *s, ptrdiff_t i,
-				     size_t n)
+static void
+wrap_strncpy_dstarray_diff_neg (char *d, const char *s, ptrdiff_t i, size_t n)
 {
   strncpy (d + i, s, n);   /* { dg-warning "offset -\[0-9\]+ is out of the bounds \\\[0, 90] of object .ar10. with type .(struct )?Array ?\\\[2]." "strncpy" } */
 }
diff --git a/gcc/testsuite/c-c++-common/Wrestrict-2.c b/gcc/testsuite/c-c++-common/Wrestrict-2.c
index f440e7b..2c10eef 100644
--- a/gcc/testsuite/c-c++-common/Wrestrict-2.c
+++ b/gcc/testsuite/c-c++-common/Wrestrict-2.c
@@ -10,7 +10,7 @@ 
 
 #include <string.h>
 
-void wrap_memcpy (void *d, const void *s, size_t n)
+static void wrap_memcpy (void *d, const void *s, size_t n)
 {
   memcpy (d, s, n);   /* { dg-warning "source argument is the same as destination" "memcpy" } */
 }
@@ -22,7 +22,7 @@  void call_memcpy (void *d, size_t n)
 }
 
 
-void wrap_strcat (char *d, const char *s)
+static void wrap_strcat (char *d, const char *s)
 {
   strcat (d, s);   /* { dg-warning "source argument is the same as destination" "strcat" } */
 }
@@ -34,7 +34,7 @@  void call_strcat (char *d)
 }
 
 
-void wrap_strcpy (char *d, const char *s)
+static void wrap_strcpy (char *d, const char *s)
 {
   strcpy (d, s);   /* { dg-warning "source argument is the same as destination" "strcpy" } */
 }
@@ -46,7 +46,7 @@  void call_strcpy (char *d)
 }
 
 
-void wrap_strncat (char *d, const char *s, size_t n)
+static void wrap_strncat (char *d, const char *s, size_t n)
 {
   strncat (d, s, n);   /* { dg-warning "source argument is the same as destination" "strncat" } */
 }
@@ -58,7 +58,7 @@  void call_strncat (char *d, size_t n)
 }
 
 
-void wrap_strncpy (char *d, const char *s, size_t n)
+static void wrap_strncpy (char *d, const char *s, size_t n)
 {
   strncpy (d, s, n);   /* { dg-warning "source argument is the same as destination" "strncpy" } */
 }
diff --git a/gcc/testsuite/c-c++-common/Wstringop-truncation.c b/gcc/testsuite/c-c++-common/Wstringop-truncation.c
index bd52091..e78e85e 100644
--- a/gcc/testsuite/c-c++-common/Wstringop-truncation.c
+++ b/gcc/testsuite/c-c++-common/Wstringop-truncation.c
@@ -18,13 +18,13 @@  char* strncpy (char*, const char*, size_t);
 }
 #endif
 
-extern size_t unsigned_value (void)
+static size_t unsigned_value (void)
 {
   extern volatile size_t unsigned_value_source;
   return unsigned_value_source;
 }
 
-size_t unsigned_range (size_t min, size_t max)
+static size_t unsigned_range (size_t min, size_t max)
 {
   size_t val = unsigned_value ();
   return val < min || max < val ? min : val;
diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-22.c b/gcc/testsuite/gcc.dg/Warray-bounds-22.c
index f66bfb3..8165140 100644
--- a/gcc/testsuite/gcc.dg/Warray-bounds-22.c
+++ b/gcc/testsuite/gcc.dg/Warray-bounds-22.c
@@ -11,13 +11,13 @@ 
 typedef __PTRDIFF_TYPE__ ptrdiff_t;
 typedef __SIZE_TYPE__    size_t;
 
-extern ptrdiff_t signed_value (void)
+static ptrdiff_t signed_value (void)
 {
   extern volatile ptrdiff_t signed_value_source;
   return signed_value_source;
 }
 
-ptrdiff_t signed_range (ptrdiff_t min, ptrdiff_t max)
+static ptrdiff_t signed_range (ptrdiff_t min, ptrdiff_t max)
 {
   ptrdiff_t val = signed_value ();
   return val < min || max < val ? min : val;
diff --git a/gcc/testsuite/gcc.dg/Wstringop-overflow.c b/gcc/testsuite/gcc.dg/Wstringop-overflow.c
index b5bd40e..c615dae 100644
--- a/gcc/testsuite/gcc.dg/Wstringop-overflow.c
+++ b/gcc/testsuite/gcc.dg/Wstringop-overflow.c
@@ -15,13 +15,13 @@  extern char* strncpy (char*, const char*, size_t);
 
 void sink (void*);
 
-extern size_t unsigned_value (void)
+static size_t unsigned_value (void)
 {
   extern volatile size_t unsigned_value_source;
   return unsigned_value_source;
 }
 
-size_t unsigned_range (size_t min, size_t max)
+static size_t unsigned_range (size_t min, size_t max)
 {
   size_t val = unsigned_value ();
   return val < min || max < val ? min : val;
diff --git a/gcc/testsuite/gcc.dg/attr-alloc_size-3.c b/gcc/testsuite/gcc.dg/attr-alloc_size-3.c
index 3be8886..96ff077 100644
--- a/gcc/testsuite/gcc.dg/attr-alloc_size-3.c
+++ b/gcc/testsuite/gcc.dg/attr-alloc_size-3.c
@@ -65,7 +65,7 @@  void* f_llong_2 (long long, long long) ALLOC_SIZE (1, 2);
 void* f_size_1 (size_t) ALLOC_SIZE (1);
 void* f_size_2 (size_t, size_t) ALLOC_SIZE (1, 2);
 
-size_t
+static size_t
 unsigned_range (size_t min, size_t max)
 {
   extern size_t random_unsigned_value (void);
@@ -74,7 +74,7 @@  unsigned_range (size_t min, size_t max)
   return val;
 }
 
-long long
+static long long
 signed_range (long long min, long long max)
 {
   extern long long random_signed_value (void);
@@ -83,7 +83,7 @@  signed_range (long long min, long long max)
   return val;
 }
 
-size_t
+static size_t
 unsigned_anti_range (size_t min, size_t max)
 {
   extern size_t random_unsigned_value (void);
@@ -93,16 +93,6 @@  unsigned_anti_range (size_t min, size_t max)
   return val;
 }
 
-long long
-signed_anti_range (long long min, long long max)
-{
-  extern long long random_signed_value (void);
-  long long val = random_signed_value ();
-  if (min <= val && val <= max)
-    val = min - 1;
-  return val;
-}
-
 #define UR(min, max) unsigned_range (min, max)
 #define SR(min, max) signed_range (min, max)
 
diff --git a/gcc/testsuite/gcc.dg/attr-alloc_size-4.c b/gcc/testsuite/gcc.dg/attr-alloc_size-4.c
index cafcfe3..6ee064b 100644
--- a/gcc/testsuite/gcc.dg/attr-alloc_size-4.c
+++ b/gcc/testsuite/gcc.dg/attr-alloc_size-4.c
@@ -25,7 +25,7 @@  void* f_int_2 (int, int) ALLOC_SIZE (1, 2);
 void* f_size_1 (size_t) ALLOC_SIZE (1);
 void* f_size_2 (size_t, size_t) ALLOC_SIZE (1, 2);
 
-size_t
+static size_t
 unsigned_range (size_t min, size_t max)
 {
   extern size_t random_unsigned_value (void);
@@ -34,7 +34,7 @@  unsigned_range (size_t min, size_t max)
   return val;
 }
 
-int
+static int
 signed_range (int min, int max)
 {
   extern int random_signed_value (void);
@@ -43,7 +43,7 @@  signed_range (int min, int max)
   return val;
 }
 
-size_t
+static size_t
 unsigned_anti_range (size_t min, size_t max)
 {
   extern size_t random_unsigned_value (void);
@@ -53,7 +53,7 @@  unsigned_anti_range (size_t min, size_t max)
   return val;
 }
 
-int
+static int
 signed_anti_range (int min, int max)
 {
   extern int random_signed_value (void);
diff --git a/gcc/testsuite/gcc.dg/attr-alloc_size-7.c b/gcc/testsuite/gcc.dg/attr-alloc_size-7.c
index 9a39829..68602ec 100644
--- a/gcc/testsuite/gcc.dg/attr-alloc_size-7.c
+++ b/gcc/testsuite/gcc.dg/attr-alloc_size-7.c
@@ -13,7 +13,7 @@  typedef __SIZE_TYPE__ size_t;
 
 void sink (void*);
 
-size_t maxobjsize (void)
+static size_t maxobjsize (void)
 {
   return MAXOBJSZ;
 }
diff --git a/gcc/testsuite/gcc.dg/attr-alloc_size-8.c b/gcc/testsuite/gcc.dg/attr-alloc_size-8.c
index b8ba942..7dc3b02 100644
--- a/gcc/testsuite/gcc.dg/attr-alloc_size-8.c
+++ b/gcc/testsuite/gcc.dg/attr-alloc_size-8.c
@@ -12,22 +12,22 @@  typedef __SIZE_TYPE__ size_t;
 
 void sink (void*);
 
-size_t alloc_size_limit (void)
+static size_t alloc_size_limit (void)
 {
   return 123;
 }
 
-size_t alloca_limit (void)
+static size_t alloca_limit (void)
 {
   return 234;
 }
 
-size_t vla_limit (void)
+static size_t vla_limit (void)
 {
   return 345;
 }
 
-void test_alloca (void)
+static void test_alloca (void)
 {
   void *p;
 
diff --git a/gcc/testsuite/gcc.dg/builtin-alloc-size.c b/gcc/testsuite/gcc.dg/builtin-alloc-size.c
index cff3e8a..400fd9b 100644
--- a/gcc/testsuite/gcc.dg/builtin-alloc-size.c
+++ b/gcc/testsuite/gcc.dg/builtin-alloc-size.c
@@ -8,7 +8,7 @@ 
 
 void sink (void*);
 
-unsigned size (unsigned n)
+static unsigned size (unsigned n)
 {
   return n;
 }
diff --git a/gcc/testsuite/gcc.dg/builtin-stpncpy.c b/gcc/testsuite/gcc.dg/builtin-stpncpy.c
index 938221b..9a094fb 100644
--- a/gcc/testsuite/gcc.dg/builtin-stpncpy.c
+++ b/gcc/testsuite/gcc.dg/builtin-stpncpy.c
@@ -12,7 +12,7 @@  void sink (char*);
 
 size_t value (void);
 
-size_t range (size_t min, size_t max)
+static size_t range (size_t min, size_t max)
 {
   size_t val = value ();
   return val < min || max < val ? min : val;
diff --git a/gcc/testsuite/gcc.dg/builtins-nonnull.c b/gcc/testsuite/gcc.dg/builtins-nonnull.c
index 726f8e1..f8c482e 100644
--- a/gcc/testsuite/gcc.dg/builtins-nonnull.c
+++ b/gcc/testsuite/gcc.dg/builtins-nonnull.c
@@ -7,7 +7,7 @@ 
 
 typedef struct FILE FILE;
 
-char* null (void)
+static char* null (void)
 {
   return 0;
 }
diff --git a/gcc/testsuite/gcc.dg/nonnull-4.c b/gcc/testsuite/gcc.dg/nonnull-4.c
index 577a04c..a28458c 100644
--- a/gcc/testsuite/gcc.dg/nonnull-4.c
+++ b/gcc/testsuite/gcc.dg/nonnull-4.c
@@ -25,7 +25,7 @@  g16_1_3_5_7_11_13 (void*, void*, void*, void*,
 		   void*, void*, void*, void*,
 		   void*, void*, void*, void*);
 
-void* null (void) { return 0; }
+static void* null (void) { return 0; }
 
 void test (void)
 {
diff --git a/gcc/testsuite/gcc.dg/pr79214.c b/gcc/testsuite/gcc.dg/pr79214.c
index 6cf254fb..23119ed 100644
--- a/gcc/testsuite/gcc.dg/pr79214.c
+++ b/gcc/testsuite/gcc.dg/pr79214.c
@@ -10,7 +10,7 @@  typedef __SIZE_TYPE__ size_t;
 char d[3];
 char s[4];
 
-size_t range (void)
+static size_t range (void)
 {
   extern size_t size ();
   size_t n = size ();
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/builtin-snprintf-warn-1.c b/gcc/testsuite/gcc.dg/tree-ssa/builtin-snprintf-warn-1.c
index 3a6586b..42284dc 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/builtin-snprintf-warn-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/builtin-snprintf-warn-1.c
@@ -17,7 +17,7 @@  typedef struct
 char buffer[1024];
 #define buffer(size) (buffer + sizeof buffer - size)
 
-int value_range (int min, int max)
+static int value_range (int min, int max)
 {
   extern int value (void);
   int val = value ();
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/builtin-snprintf-warn-2.c b/gcc/testsuite/gcc.dg/tree-ssa/builtin-snprintf-warn-2.c
index 54f3198..e1e1a02 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/builtin-snprintf-warn-2.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/builtin-snprintf-warn-2.c
@@ -17,7 +17,7 @@  typedef struct
 char buffer[1024];
 #define buffer(size) (buffer + sizeof buffer - size)
 
-int value_range (int min, int max)
+static int value_range (int min, int max)
 {
   extern int value (void);
   int val = value ();
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-5.c b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-5.c
index 7870f55..fb7a1bd 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-5.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-5.c
@@ -28,7 +28,7 @@ 
     ASSERT (n, expect);					\
   } while (0)
 
-int ival (int i) { return i; }
+static int ival (int i) { return i; }
 
 /* Generate a signed int value in the specified range.  */
 
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-11.c b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-11.c
index b714c95..02072b5 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-11.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-11.c
@@ -19,18 +19,12 @@  typedef __WCHAR_TYPE__ wchar_t;
 extern int int_value (void);
 extern size_t size_value (void);
 
-int int_range (int min, int max)
+static int int_range (int min, int max)
 {
   int n = int_value ();
   return n < min || max < n ? min : n;
 }
 
-size_t size_range (size_t min, size_t max)
-{
-  size_t n = size_value ();
-  return n < min || max < n ? min : n;
-}
-
 void sink (char*, char*);
 
 int dummy_sprintf (char*, const char*, ...);
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-12.c b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-12.c
index bdea46f..7137f82 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-12.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-12.c
@@ -23,14 +23,14 @@  int dummy_sprintf (char*, const char*, ...);
 char buffer [256];
 extern char *ptr;
 
-int int_range (int min, int max)
+static int int_range (int min, int max)
 {
   extern int int_value (void);
   int n = int_value ();
   return n < min || max < n ? min : n;
 }
 
-unsigned uint_range (unsigned min, unsigned max)
+static unsigned uint_range (unsigned min, unsigned max)
 {
   extern unsigned uint_value (void);
   unsigned n = uint_value ();
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-13.c b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-13.c
index 27a9972..1175127 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-13.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-13.c
@@ -22,20 +22,13 @@  int dummy_sprintf (char*, const char*, ...);
 char buffer [256];
 extern char *ptr;
 
-int int_range (int min, int max)
+static int int_range (int min, int max)
 {
   extern int int_value (void);
   int n = int_value ();
   return n < min || max < n ? min : n;
 }
 
-unsigned uint_range (unsigned min, unsigned max)
-{
-  extern unsigned uint_value (void);
-  unsigned n = uint_value ();
-  return n < min || max < n ? min : n;
-}
-
 /* Evaluate to an array of SIZE characters when non-negative, or to
    a pointer to an unknown object otherwise.  */
 #define buffer(size)					\
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-14.c b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-14.c
index dc3f132..d6f3f0c 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-14.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-14.c
@@ -17,13 +17,13 @@  typedef __SIZE_TYPE__  size_t;
 
 extern int int_value (void);
 
-int int_range (int min, int max)
+static int int_range (int min, int max)
 {
   int n = int_value ();
   return n < min || max < n ? min : n;
 }
 
-const char*
+static const char*
 choose_string (const char *s1, const char *s2, const char *s3)
 {
   int i = int_value ();
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-15.c b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-15.c
index 0b863a8..29ae50c 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-15.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-15.c
@@ -24,20 +24,13 @@  int dummy_sprintf (char*, const char*, ...);
 char buffer [1024];
 extern char *ptr;
 
-int int_range (int min, int max)
+static int int_range (int min, int max)
 {
   extern int int_value (void);
   int n = int_value ();
   return n < min || max < n ? min : n;
 }
 
-unsigned uint_range (unsigned min, unsigned max)
-{
-  extern unsigned uint_value (void);
-  unsigned n = uint_value ();
-  return n < min || max < n ? min : n;
-}
-
 /* Evaluate to an array of SIZE characters when non-negative, or to
    a pointer to an unknown object otherwise.  */
 #define buffer(size)					\
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-19.c b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-19.c
index e043938..1ab19e0 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-19.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-19.c
@@ -6,7 +6,7 @@ 
 
 void sink (char*);
 
-long long integer_range (long long min, long long max)
+static long long integer_range (long long min, long long max)
 {
   extern long long integer_value (void);
   long long n = integer_value ();
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-3.c b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-3.c
index 7cbcbdb..d06248b 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-3.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-3.c
@@ -40,8 +40,8 @@  void sink (void*);
    of the operand even when it's not constant (i.e., makes use of
    inlining and constant propagation information).  */
 
-int i (int x) { return x; }
-const char* s (const char *str) { return str; }
+static int i (int x) { return x; }
+static const char* s (const char *str) { return str; }
 
 /* Function to "generate" a unique unknown number (as far as GCC can
    tell) each time it's called.  It prevents the optimizer from being
@@ -140,42 +140,42 @@  extern int rand (void);
    avoid diagnosing the output of sufficiently constrained arguments to
    integer directives.  */
 
-signed char
+static signed char
 range_schar (signed char min, signed char max)
 {
   signed char val = rand ();
   return val < min || max < val ? min : val;
 }
 
-unsigned char
+static unsigned char
 range_uchar (unsigned char min, unsigned char max)
 {
   unsigned char val = rand ();
   return val < min || max < val ? min : val;
 }
 
-signed short
+static signed short
 range_sshrt (signed short min, signed short max)
 {
   signed short val = rand ();
   return val < min || max < val ? min : val;
 }
 
-unsigned short
+static unsigned short
 range_ushrt (unsigned short min, unsigned short max)
 {
   unsigned short val = rand ();
   return val < min || max < val ? min : val;
 }
 
-signed int
+static signed int
 range_sint (signed int min, signed int max)
 {
   signed int val = rand ();
   return val < min || max < val ? min : val;
 }
 
-unsigned int
+static unsigned int
 range_uint (unsigned int min, unsigned int max)
 {
   unsigned int val = rand ();
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-9.c b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-9.c
index 59d2927..9eb462e 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-9.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-9.c
@@ -38,8 +38,8 @@  char *ptr;
    of the operand even when it's not constant (i.e., makes use of
    inlining and constant propagation information).  */
 
-int i (int x) { return x; }
-const char* s (const char *str) { return str; }
+static int i (int x) { return x; }
+static const char* s (const char *str) { return str; }
 
 /* Function to "generate" a unique unknown number (as far as GCC can
    tell) each time it's called.  It prevents the optimizer from being
@@ -48,7 +48,7 @@  const char* s (const char *str) { return str; }
 extern int value (void);
 
 /* Return a value in the range [MIN, MAX].  */
-int range (int min, int max)
+static int range (int min, int max)
 {
   int val = value ();
   return val < min || max < val ? min : val;