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]

[4.1 PATCH]: testsuite backports for -fpic/-fPIC


This is the 4.1 branch version of my previous patch.  Although perhaps we
won't make any further releases from this branch, I still test it from
time to time and would like to reduce the "noise" from the testsuite.

Differences from the 4.2 version are that several patch bits are removed
if the testcase doesn't exists in 4.1.  Also, on the 4.1 branch the
definitions of __PIC__ and __pic__ are not uniform.  So I check for
either/both macros.

Tested on x86_64-unknown-linux-gnu, no regressions and the testcases now
pass with -fpic/-fPIC.

Okay for 4.1 branch?

		Thanks,
		--Kaveh


2008-01-08  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* gcc.c-torture/execute/builtins/chk.h: Don't check !__PIE__.
	Also check __pic__.
	* lib/target-supports.exp (check_effective_target_nonpic): Likewise.
	* gcc.dg/assign-warn-3.c: Use "static inline" instead of "inline".

	Backport:

	2007-03-21  Richard Sandiford  <richard@codesourcery.com>
	* gcc.c-torture/execute/builtins/chk.h (LOCAL): Define.
	* gcc.c-torture/execute/builtins/sprintf-chk.c (s1): Make LOCAL.
	* gcc.c-torture/execute/builtins/stpcpy-chk.c (s1): Likewise.
	* gcc.c-torture/execute/builtins/strcpy-chk.c (s1): Likewise.

	2007-07-26  Nathan Froyd  <froydnj@codesourcery.com>
	PR/19232
	* gcc.dg/assign-warn-3.c (f0): Declare as inline.
	(f1): Likewise.

	2007-01-15  Dale Johannesen  <dalej@apple.com>
	* gcc.dg/tree-ssa/loop-3.c:  Disable with -fpic or -fPIC.

	2007-03-21  Richard Sandiford  <richard@codesourcery.com>
	* lib/target-supports.exp (check_effective_target_nonpic): New
	procedure.

diff -rup orig/egcc-4.1-SVN20080107/gcc/testsuite/gcc.c-torture/execute/builtins/chk.h egcc-4.1-SVN20080107/gcc/testsuite/gcc.c-torture/execute/builtins/chk.h
--- orig/egcc-4.1-SVN20080107/gcc/testsuite/gcc.c-torture/execute/builtins/chk.h	2008-01-03 23:34:45.000000000 +0100
+++ egcc-4.1-SVN20080107/gcc/testsuite/gcc.c-torture/execute/builtins/chk.h	2008-01-08 08:01:35.000000000 +0100
@@ -79,3 +79,11 @@ extern volatile int memset_disallowed, s
 extern volatile int strncpy_disallowed, strcat_disallowed, strncat_disallowed;
 extern volatile int sprintf_disallowed, vsprintf_disallowed;
 extern volatile int snprintf_disallowed, vsnprintf_disallowed;
+
+/* A storage class that ensures that declarations bind locally.  We want
+   to test non-static declarations where we know it is safe to do so.  */
+#if __PIC__ || __pic__
+#define LOCAL static
+#else
+#define LOCAL
+#endif
diff -rup orig/egcc-4.1-SVN20080107/gcc/testsuite/gcc.c-torture/execute/builtins/sprintf-chk.c egcc-4.1-SVN20080107/gcc/testsuite/gcc.c-torture/execute/builtins/sprintf-chk.c
--- orig/egcc-4.1-SVN20080107/gcc/testsuite/gcc.c-torture/execute/builtins/sprintf-chk.c	2008-01-03 23:34:45.000000000 +0100
+++ egcc-4.1-SVN20080107/gcc/testsuite/gcc.c-torture/execute/builtins/sprintf-chk.c	2008-01-08 07:55:45.000000000 +0100
@@ -13,7 +13,7 @@ extern int sprintf (char *, const char *

 #include "chk.h"

-const char s1[] = "123";
+LOCAL const char s1[] = "123";
 char p[32] = "";
 char *s2 = "defg";
 char *s3 = "FGH";
diff -rup orig/egcc-4.1-SVN20080107/gcc/testsuite/gcc.c-torture/execute/builtins/stpcpy-chk.c egcc-4.1-SVN20080107/gcc/testsuite/gcc.c-torture/execute/builtins/stpcpy-chk.c
--- orig/egcc-4.1-SVN20080107/gcc/testsuite/gcc.c-torture/execute/builtins/stpcpy-chk.c	2008-01-03 23:34:45.000000000 +0100
+++ egcc-4.1-SVN20080107/gcc/testsuite/gcc.c-torture/execute/builtins/stpcpy-chk.c	2008-01-08 07:55:45.000000000 +0100
@@ -11,7 +11,7 @@ extern int memcmp (const void *, const v

 #include "chk.h"

-const char s1[] = "123";
+LOCAL const char s1[] = "123";
 char p[32] = "";
 char *s2 = "defg";
 char *s3 = "FGH";
diff -rup orig/egcc-4.1-SVN20080107/gcc/testsuite/gcc.c-torture/execute/builtins/strcpy-chk.c egcc-4.1-SVN20080107/gcc/testsuite/gcc.c-torture/execute/builtins/strcpy-chk.c
--- orig/egcc-4.1-SVN20080107/gcc/testsuite/gcc.c-torture/execute/builtins/strcpy-chk.c	2008-01-03 23:34:45.000000000 +0100
+++ egcc-4.1-SVN20080107/gcc/testsuite/gcc.c-torture/execute/builtins/strcpy-chk.c	2008-01-08 07:55:45.000000000 +0100
@@ -11,7 +11,7 @@ extern int memcmp (const void *, const v

 #include "chk.h"

-const char s1[] = "123";
+LOCAL const char s1[] = "123";
 char p[32] = "";
 char *s2 = "defg";
 char *s3 = "FGH";
diff -rup orig/egcc-4.1-SVN20080107/gcc/testsuite/gcc.dg/assign-warn-3.c egcc-4.1-SVN20080107/gcc/testsuite/gcc.dg/assign-warn-3.c
--- orig/egcc-4.1-SVN20080107/gcc/testsuite/gcc.dg/assign-warn-3.c	2008-01-03 23:35:04.000000000 +0100
+++ egcc-4.1-SVN20080107/gcc/testsuite/gcc.dg/assign-warn-3.c	2008-01-08 07:55:45.000000000 +0100
@@ -5,9 +5,9 @@
 /* { dg-options "-O3 -std=c99 -pedantic-errors" } */

 /* This is valid to execute, so maybe shouldn't warn at all.  */
-void f0(x) signed char *x; { }
+static inline void f0(x) signed char *x; { }
 void g0(unsigned char *x) { f0(x); } /* { dg-warning "warning: pointer targets in passing argument 1 of 'f0' differ in signedness" } */

 /* This is undefined on execution but still must compile.  */
-void f1(x) int *x; { }
+static inline void f1(x) int *x; { }
 void g1(unsigned int *x) { f1(x); } /* { dg-warning "warning: pointer targets in passing argument 1 of 'f1' differ in signedness" } */
diff -rup orig/egcc-4.1-SVN20080107/gcc/testsuite/gcc.dg/tree-ssa/loop-3.c egcc-4.1-SVN20080107/gcc/testsuite/gcc.dg/tree-ssa/loop-3.c
--- orig/egcc-4.1-SVN20080107/gcc/testsuite/gcc.dg/tree-ssa/loop-3.c	2008-01-03 23:34:54.000000000 +0100
+++ egcc-4.1-SVN20080107/gcc/testsuite/gcc.dg/tree-ssa/loop-3.c	2008-01-08 07:58:27.000000000 +0100
@@ -3,7 +3,8 @@
    assume something about memory addressing modes.  */

 /* { dg-do compile { target i?86-*-* x86_64-*-* } } */
-/* { dg-options "-O1 -fdump-tree-vars" } */
+/* { dg-skip-if "" { i?86-*-* x86_64-*-* } { "-fpic" "-fPIC" } { "" } } */
+/* { dg-options "-O1 -fno-pic -fno-PIC -fdump-tree-vars" } */

 int arr_base[100];

diff -rup orig/egcc-4.1-SVN20080107/gcc/testsuite/lib/target-supports.exp egcc-4.1-SVN20080107/gcc/testsuite/lib/target-supports.exp
--- orig/egcc-4.1-SVN20080107/gcc/testsuite/lib/target-supports.exp	2008-01-03 23:36:01.000000000 +0100
+++ egcc-4.1-SVN20080107/gcc/testsuite/lib/target-supports.exp	2008-01-08 08:01:58.000000000 +0100
@@ -490,6 +490,16 @@ proc check_effective_target_fpic { } {
     return 0
 }

+# Return 1 if the current multilib does not generate PIC by default.
+
+proc check_effective_target_nonpic { } {
+    return [check_no_compiler_messages nonpic assembly {
+	#if __PIC__ || __pic__
+	#error FOO
+	#endif
+    }]
+}
+
 # Return true if iconv is supported on the target. In particular IBM1047.

 proc check_iconv_available { test_what } {


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