]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
chk.h: Don't check !__PIE__.
authorKaveh R. Ghazi <ghazi@caip.rutgers.edu>
Wed, 9 Jan 2008 06:12:26 +0000 (06:12 +0000)
committerKaveh Ghazi <ghazi@gcc.gnu.org>
Wed, 9 Jan 2008 06:12:26 +0000 (06:12 +0000)
* 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.

From-SVN: r131413

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/execute/builtins/chk.h
gcc/testsuite/gcc.c-torture/execute/builtins/sprintf-chk.c
gcc/testsuite/gcc.c-torture/execute/builtins/stpcpy-chk.c
gcc/testsuite/gcc.c-torture/execute/builtins/strcpy-chk.c
gcc/testsuite/gcc.dg/assign-warn-3.c
gcc/testsuite/gcc.dg/tree-ssa/loop-3.c
gcc/testsuite/lib/target-supports.exp

index 503238c6af571ac8a09056f97f637cdf2b639096..e041686832bbb0b6b0bce2bf28dadfc4ed16a4f1 100644 (file)
@@ -1,3 +1,30 @@
+2008-01-09  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.
+
 2007-12-20  Jakub Jelinek  <jakub@redhat.com>
 
        PR bootstrap/34003
index dfef410c61b858641a34c44183e27c5e5a36785d..f91ec78c4ec3154231cba81876b88f105d97e6ce 100644 (file)
@@ -79,3 +79,11 @@ extern volatile int memset_disallowed, strcpy_disallowed, stpcpy_disallowed;
 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
index 95d2a9d2826b50e3313bcd05d47ba7d320f4926f..2862ab6dc91f6acf8e442435580da52bf6143dcc 100644 (file)
@@ -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";
index b292c0aec8733abc39f4191f7d6637509d44aec9..6091f129359274cad0ae90bbec99f2262065cfb3 100644 (file)
@@ -11,7 +11,7 @@ extern int memcmp (const void *, const void *, size_t);
 
 #include "chk.h"
 
-const char s1[] = "123";
+LOCAL const char s1[] = "123";
 char p[32] = "";
 char *s2 = "defg";
 char *s3 = "FGH";
index 002dd19500ed28c52a709f0df9e04cb0f9617344..b3c1a3899d9612fe67bbe56692e14f6d52668a3f 100644 (file)
@@ -11,7 +11,7 @@ extern int memcmp (const void *, const void *, size_t);
 
 #include "chk.h"
 
-const char s1[] = "123";
+LOCAL const char s1[] = "123";
 char p[32] = "";
 char *s2 = "defg";
 char *s3 = "FGH";
index 1463fce0f68d31ac0a2eaf0afe39644eb66d159c..4ff7b88fa5f7859612cc824442f8afec1e4d80b7 100644 (file)
@@ -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" } */
index 82d1d2d73c5f54cf0cca566d4768a1b1c7ec39ed..c71791480c65bf0bc4235310d93ec2581519e861 100644 (file)
@@ -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];
 
index 01120ab6bdf8070e4024082a212e3458e0569848..c473826b00c69591aa414240c22ddd9e962a6a79 100644 (file)
@@ -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 } {