aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg')
-rw-r--r--gcc/testsuite/gcc.dg/20030321-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/20040813-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/20041106-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/Wstring-literal-comparison-1.c29
-rw-r--r--gcc/testsuite/gcc.dg/Wstring-literal-comparison-2.c29
-rw-r--r--gcc/testsuite/gcc.dg/Wstring-literal-comparison-3.c29
-rw-r--r--gcc/testsuite/gcc.dg/Wstring-literal-comparison-4.c29
-rw-r--r--gcc/testsuite/gcc.dg/alias-9.c20
-rw-r--r--gcc/testsuite/gcc.dg/attr-weakref-1.c102
-rw-r--r--gcc/testsuite/gcc.dg/attr-weakref-1b.c20
-rw-r--r--gcc/testsuite/gcc.dg/attr-weakref-2.c7
-rw-r--r--gcc/testsuite/gcc.dg/builtins-20.c18
-rw-r--r--gcc/testsuite/gcc.dg/c90-const-expr-4.c11
-rw-r--r--gcc/testsuite/gcc.dg/c90-const-expr-5.c39
-rw-r--r--gcc/testsuite/gcc.dg/c99-const-expr-4.c11
-rw-r--r--gcc/testsuite/gcc.dg/c99-const-expr-5.c39
-rw-r--r--gcc/testsuite/gcc.dg/cast-pretty-print-1.c12
-rw-r--r--gcc/testsuite/gcc.dg/charset/builtin2.c32
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-layout-1_generate.c4
-rw-r--r--gcc/testsuite/gcc.dg/darwin-weakimport-3.c10
-rw-r--r--gcc/testsuite/gcc.dg/darwin-weakref-1.c28
-rw-r--r--gcc/testsuite/gcc.dg/format/cast-1.c16
-rw-r--r--gcc/testsuite/gcc.dg/lvalue-2.c12
-rw-r--r--gcc/testsuite/gcc.dg/lvalue1.c2
-rw-r--r--gcc/testsuite/gcc.dg/nest.c1
-rw-r--r--gcc/testsuite/gcc.dg/pr17112-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/pr17730-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/tls/alias-1.c1
-rw-r--r--gcc/testsuite/gcc.dg/tls/alpha-1.c1
-rw-r--r--gcc/testsuite/gcc.dg/tls/asm-1.c1
-rw-r--r--gcc/testsuite/gcc.dg/tls/debug-1.c1
-rw-r--r--gcc/testsuite/gcc.dg/tls/diag-1.c1
-rw-r--r--gcc/testsuite/gcc.dg/tls/diag-2.c1
-rw-r--r--gcc/testsuite/gcc.dg/tls/diag-3.c1
-rw-r--r--gcc/testsuite/gcc.dg/tls/diag-4.c1
-rw-r--r--gcc/testsuite/gcc.dg/tls/diag-5.c1
-rw-r--r--gcc/testsuite/gcc.dg/tls/init-1.c1
-rw-r--r--gcc/testsuite/gcc.dg/tls/nonpic-1.c1
-rw-r--r--gcc/testsuite/gcc.dg/tls/opt-1.c1
-rw-r--r--gcc/testsuite/gcc.dg/tls/opt-10.c1
-rw-r--r--gcc/testsuite/gcc.dg/tls/opt-11.c33
-rw-r--r--gcc/testsuite/gcc.dg/tls/opt-2.c1
-rw-r--r--gcc/testsuite/gcc.dg/tls/opt-3.c1
-rw-r--r--gcc/testsuite/gcc.dg/tls/opt-4.c1
-rw-r--r--gcc/testsuite/gcc.dg/tls/opt-5.c1
-rw-r--r--gcc/testsuite/gcc.dg/tls/opt-6.c1
-rw-r--r--gcc/testsuite/gcc.dg/tls/opt-7.c1
-rw-r--r--gcc/testsuite/gcc.dg/tls/opt-8.c1
-rw-r--r--gcc/testsuite/gcc.dg/tls/opt-9.c1
-rw-r--r--gcc/testsuite/gcc.dg/tls/pic-1.c1
-rw-r--r--gcc/testsuite/gcc.dg/tls/pr24428-2.c1
-rw-r--r--gcc/testsuite/gcc.dg/tls/pr24428.c1
-rw-r--r--gcc/testsuite/gcc.dg/tls/section-1.c1
-rw-r--r--gcc/testsuite/gcc.dg/tls/struct-1.c1
-rw-r--r--gcc/testsuite/gcc.dg/tls/tls.exp12
-rw-r--r--gcc/testsuite/gcc.dg/tls/trivial.c2
-rw-r--r--gcc/testsuite/gcc.dg/torture/fp-int-convert-float128-timode.c1
-rw-r--r--gcc/testsuite/gcc.dg/torture/fp-int-convert-timode.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/20031106-6.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/divide-3.c14
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/divide-4.c14
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-dce-2.c4
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-62.c1
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-76.c3
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-reduc-1char.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-reduc-1short.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-reduc-2char.c2
-rw-r--r--gcc/testsuite/gcc.dg/vect/vect-reduc-2short.c2
68 files changed, 542 insertions, 90 deletions
diff --git a/gcc/testsuite/gcc.dg/20030321-1.c b/gcc/testsuite/gcc.dg/20030321-1.c
index 228acec5471..1150c7f7619 100644
--- a/gcc/testsuite/gcc.dg/20030321-1.c
+++ b/gcc/testsuite/gcc.dg/20030321-1.c
@@ -7,7 +7,7 @@
struct array
{
char align[4092];
- long long elem[2] __attribute__ ((__packed__));
+ long long elem[2] __attribute__ ((__packed__)); /* { dg-warning "attribute ignored" "" { target default_packed } } */
};
long long
diff --git a/gcc/testsuite/gcc.dg/20040813-1.c b/gcc/testsuite/gcc.dg/20040813-1.c
index aa8d166302d..a983886da29 100644
--- a/gcc/testsuite/gcc.dg/20040813-1.c
+++ b/gcc/testsuite/gcc.dg/20040813-1.c
@@ -2,7 +2,7 @@
/* Contributed by Devang Patel <dpatel@apple.com> */
/* { dg-do compile } */
-/* { dg-skip-if "No stabs" { mmix-*-* *-*-aix* *-*-netware* alpha*-*-* hppa*64*-*-* ia64-*-* } { "*" } { "" } } */
+/* { dg-skip-if "No stabs" { mmix-*-* *-*-aix* *-*-netware* alpha*-*-* hppa*64*-*-* ia64-*-* *-*-sysv5* } { "*" } { "" } } */
/* { dg-options "-gstabs" } */
int
diff --git a/gcc/testsuite/gcc.dg/20041106-1.c b/gcc/testsuite/gcc.dg/20041106-1.c
index 538f2dd8eb5..f83e835ed1d 100644
--- a/gcc/testsuite/gcc.dg/20041106-1.c
+++ b/gcc/testsuite/gcc.dg/20041106-1.c
@@ -6,7 +6,7 @@
#include <unistd.h>
#include <stdlib.h>
-struct S { long x __attribute__((packed)); };
+struct S { long x __attribute__((packed)); }; /* { dg-warning "attribute ignored" "" { target default_packed } } */
volatile long sink;
void foo (struct S *s)
diff --git a/gcc/testsuite/gcc.dg/Wstring-literal-comparison-1.c b/gcc/testsuite/gcc.dg/Wstring-literal-comparison-1.c
new file mode 100644
index 00000000000..c5dea463b51
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wstring-literal-comparison-1.c
@@ -0,0 +1,29 @@
+/* PR c/7776 */
+/* { dg-do compile } */
+/* { dg-options "-Wstring-literal-comparison" } */
+
+int test1(char *ptr)
+{
+ return ptr == "foo"; /* { dg-warning "comparison with string" } */
+}
+
+int test2()
+{
+ return "foo" != (const char*)0;
+}
+
+int test3()
+{
+ return "foo" == (const char*)0;
+}
+
+int test4()
+{
+ return (const char*)0 != "foo";
+}
+
+int test5()
+{
+ return (const char*)0 == "foo";
+}
+
diff --git a/gcc/testsuite/gcc.dg/Wstring-literal-comparison-2.c b/gcc/testsuite/gcc.dg/Wstring-literal-comparison-2.c
new file mode 100644
index 00000000000..3eb91eeca49
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wstring-literal-comparison-2.c
@@ -0,0 +1,29 @@
+/* PR c/7776 */
+/* { dg-do compile } */
+/* { dg-options "-Wall" } */
+
+int test1(char *ptr)
+{
+ return ptr == "foo"; /* { dg-warning "comparison with string" } */
+}
+
+int test2()
+{
+ return "foo" != (const char*)0;
+}
+
+int test3()
+{
+ return "foo" == (const char*)0;
+}
+
+int test4()
+{
+ return (const char*)0 != "foo";
+}
+
+int test5()
+{
+ return (const char*)0 == "foo";
+}
+
diff --git a/gcc/testsuite/gcc.dg/Wstring-literal-comparison-3.c b/gcc/testsuite/gcc.dg/Wstring-literal-comparison-3.c
new file mode 100644
index 00000000000..f700a51a87b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wstring-literal-comparison-3.c
@@ -0,0 +1,29 @@
+/* PR c/7776 */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+int test1(char *ptr)
+{
+ return ptr == "foo";
+}
+
+int test2()
+{
+ return "foo" != (const char*)0;
+}
+
+int test3()
+{
+ return "foo" == (const char*)0;
+}
+
+int test4()
+{
+ return (const char*)0 != "foo";
+}
+
+int test5()
+{
+ return (const char*)0 == "foo";
+}
+
diff --git a/gcc/testsuite/gcc.dg/Wstring-literal-comparison-4.c b/gcc/testsuite/gcc.dg/Wstring-literal-comparison-4.c
new file mode 100644
index 00000000000..27f25f3ca98
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wstring-literal-comparison-4.c
@@ -0,0 +1,29 @@
+/* PR c/7776 */
+/* { dg-do compile } */
+/* { dg-options "-Wall -Wno-string-literal-comparison" } */
+
+int test1(char *ptr)
+{
+ return ptr == "foo";
+}
+
+int test2()
+{
+ return "foo" != (const char*)0;
+}
+
+int test3()
+{
+ return "foo" == (const char*)0;
+}
+
+int test4()
+{
+ return (const char*)0 != "foo";
+}
+
+int test5()
+{
+ return (const char*)0 == "foo";
+}
+
diff --git a/gcc/testsuite/gcc.dg/alias-9.c b/gcc/testsuite/gcc.dg/alias-9.c
new file mode 100644
index 00000000000..6e9d4a83e35
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/alias-9.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-Wstrict-aliasing -O2" } */
+
+int a[2];
+
+double *foo1(void)
+{
+ return (double *)a; /* { dg-warning "strict-aliasing" } */
+}
+
+double *foo2(void)
+{
+ return (double *)&a[0]; /* { dg-warning "strict-aliasing" } */
+}
+
+_Complex x;
+int *bar(void)
+{
+ return (int *)&__imag x; /* { dg-warning "strict-aliasing" } */
+}
diff --git a/gcc/testsuite/gcc.dg/attr-weakref-1.c b/gcc/testsuite/gcc.dg/attr-weakref-1.c
index c47ce1e569b..7ffd64d55ca 100644
--- a/gcc/testsuite/gcc.dg/attr-weakref-1.c
+++ b/gcc/testsuite/gcc.dg/attr-weakref-1.c
@@ -1,7 +1,9 @@
// { dg-do run }
// { dg-require-weak "" }
// { dg-options "-O2" }
+// { dg-options "-O2 -mmacosx-version-min=10.2" { target { powerpc-*-darwin* } } }
// { dg-additional-sources "attr-weakref-1a.c" }
+// { dg-additional-sources "attr-weakref-1a.c attr-weakref-1b.c" { target { *-*-darwin* } } }
// Copyright 2005 Free Software Foundation, Inc.
// Contributed by Alexandre Oliva <aoliva@redhat.com>
@@ -26,37 +28,32 @@
typedef int vtype;
extern vtype wv1;
-extern vtype Wv1a __attribute__((weakref ("wv1")));
+static vtype Wv1a __attribute__((weakref ("wv1")));
static vtype *pv1a USED = &Wv1a;
-extern vtype Wv1b __attribute__((weak, weakref, alias ("wv1")));
-static vtype *pv1b USED = &Wv1b;
-extern vtype Wv1c __attribute__((weakref));
-extern vtype Wv1c __attribute__((alias ("wv1")));
-static vtype *pv1c USED = &Wv1c;
vtype gv2;
-extern vtype Wv2a __attribute__((weakref ("gv2")));
+static vtype Wv2a __attribute__((weakref ("gv2")));
static vtype *pv2a USED = &Wv2a;
static vtype lv3;
-extern vtype Wv3a __attribute__((weakref ("lv3")));
+static vtype Wv3a __attribute__((weakref ("lv3")));
static vtype *pv3a USED = &Wv3a;
extern vtype uv4;
-extern vtype Wv4a __attribute__((weakref ("uv4")));
+static vtype Wv4a __attribute__((weakref ("uv4")));
static vtype *pv4a USED = &Wv4a;
static vtype *pv4 USED = &uv4;
-extern vtype Wv5a __attribute__((weakref ("uv5")));
+static vtype Wv5a __attribute__((weakref ("uv5")));
static vtype *pv5a USED = &Wv5a;
extern vtype uv5;
static vtype *pv5 USED = &uv5;
-extern vtype Wv6a __attribute__((weakref ("wv6")));
+static vtype Wv6a __attribute__((weakref ("wv6")));
static vtype *pv6a USED = &Wv6a;
extern vtype wv6;
-extern vtype Wv7a __attribute__((weakref ("uv7")));
+static vtype Wv7a __attribute__((weakref ("uv7")));
static vtype* USED fv7 (void) {
return &Wv7a;
}
@@ -69,71 +66,69 @@ extern vtype uv8;
static vtype* USED fv8a (void) {
return &uv8;
}
-extern vtype Wv8a __attribute__((weakref ("uv8")));
+static vtype Wv8a __attribute__((weakref ("uv8")));
static vtype* USED fv8 (void) {
return &Wv8a;
}
extern vtype wv9 __attribute__((weak));
-extern vtype Wv9a __attribute__((weakref ("wv9")));
+static vtype Wv9a __attribute__((weakref ("wv9")));
static vtype *pv9a USED = &Wv9a;
-extern vtype Wv10a __attribute__((weakref ("Wv10b")));
-extern vtype Wv10b __attribute__((weakref ("Wv10c")));
-extern vtype Wv10c __attribute__((weakref ("Wv10d")));
-extern vtype Wv10d __attribute__((weakref ("wv10")));
+static vtype Wv10a __attribute__((weakref ("Wv10b")));
+static vtype Wv10b __attribute__((weakref ("Wv10c")));
+static vtype Wv10c __attribute__((weakref ("Wv10d")));
+static vtype Wv10d __attribute__((weakref ("wv10")));
extern vtype wv10;
extern vtype wv11;
-extern vtype Wv11d __attribute__((weakref ("wv11")));
-extern vtype Wv11c __attribute__((weakref ("Wv11d")));
-extern vtype Wv11b __attribute__((weakref ("Wv11c")));
-extern vtype Wv11a __attribute__((weakref ("Wv11b")));
+static vtype Wv11d __attribute__((weakref ("wv11")));
+static vtype Wv11c __attribute__((weakref ("Wv11d")));
+static vtype Wv11b __attribute__((weakref ("Wv11c")));
+static vtype Wv11a __attribute__((weakref ("Wv11b")));
-extern vtype Wv12 __attribute__((weakref ("wv12")));
+static vtype Wv12 __attribute__((weakref ("wv12")));
extern vtype wv12 __attribute__((weak));
-extern vtype Wv13 __attribute__((weakref ("wv13")));
+static vtype Wv13 __attribute__((weakref ("wv13")));
extern vtype wv13 __attribute__((weak));
-extern vtype Wv14a __attribute__((weakref ("wv14")));
-extern vtype Wv14b __attribute__((weakref ("wv14")));
+static vtype Wv14a __attribute__((weakref ("wv14")));
+static vtype Wv14b __attribute__((weakref ("wv14")));
extern vtype wv14 __attribute__((weak));
typedef void ftype(void);
extern ftype wf1;
-extern ftype Wf1a __attribute__((weakref ("wf1")));
+static ftype Wf1a __attribute__((weakref ("wf1")));
static ftype *pf1a USED = &Wf1a;
-extern ftype Wf1b __attribute__((weak, weakref, alias ("wf1")));
-static ftype *pf1b USED = &Wf1b;
-extern ftype Wf1c __attribute__((weakref));
+static ftype Wf1c __attribute__((weakref));
extern ftype Wf1c __attribute__((alias ("wf1")));
static ftype *pf1c USED = &Wf1c;
void gf2(void) {}
-extern ftype Wf2a __attribute__((weakref ("gf2")));
+static ftype Wf2a __attribute__((weakref ("gf2")));
static ftype *pf2a USED = &Wf2a;
static void lf3(void) {}
-extern ftype Wf3a __attribute__((weakref ("lf3")));
+static ftype Wf3a __attribute__((weakref ("lf3")));
static ftype *pf3a USED = &Wf3a;
extern ftype uf4;
-extern ftype Wf4a __attribute__((weakref ("uf4")));
+static ftype Wf4a __attribute__((weakref ("uf4")));
static ftype *pf4a USED = &Wf4a;
static ftype *pf4 USED = &uf4;
-extern ftype Wf5a __attribute__((weakref ("uf5")));
+static ftype Wf5a __attribute__((weakref ("uf5")));
static ftype *pf5a USED = &Wf5a;
extern ftype uf5;
static ftype *pf5 USED = &uf5;
-extern ftype Wf6a __attribute__((weakref ("wf6")));
+static ftype Wf6a __attribute__((weakref ("wf6")));
static ftype *pf6a USED = &Wf6a;
extern ftype wf6;
-extern ftype Wf7a __attribute__((weakref ("uf7")));
+static ftype Wf7a __attribute__((weakref ("uf7")));
static ftype* USED ff7 (void) {
return &Wf7a;
}
@@ -146,43 +141,45 @@ extern ftype uf8;
static ftype* USED ff8a (void) {
return &uf8;
}
-extern ftype Wf8a __attribute__((weakref ("uf8")));
+static ftype Wf8a __attribute__((weakref ("uf8")));
static ftype* USED ff8 (void) {
return &Wf8a;
}
extern ftype wf9 __attribute__((weak));
-extern ftype Wf9a __attribute__((weakref ("wf9")));
+static ftype Wf9a __attribute__((weakref ("wf9")));
static ftype *pf9a USED = &Wf9a;
-extern ftype Wf10a __attribute__((weakref ("Wf10b")));
-extern ftype Wf10b __attribute__((weakref ("Wf10c")));
-extern ftype Wf10c __attribute__((weakref ("Wf10d")));
-extern ftype Wf10d __attribute__((weakref ("wf10")));
+static ftype Wf10a __attribute__((weakref ("Wf10b")));
+static ftype Wf10b __attribute__((weakref ("Wf10c")));
+static ftype Wf10c __attribute__((weakref ("Wf10d")));
+static ftype Wf10d __attribute__((weakref ("wf10")));
extern ftype wf10;
extern ftype wf11;
-extern ftype Wf11d __attribute__((weakref ("wf11")));
-extern ftype Wf11c __attribute__((weakref ("Wf11d")));
-extern ftype Wf11b __attribute__((weakref ("Wf11c")));
-extern ftype Wf11a __attribute__((weakref ("Wf11b")));
+static ftype Wf11d __attribute__((weakref ("wf11")));
+static ftype Wf11c __attribute__((weakref ("Wf11d")));
+static ftype Wf11b __attribute__((weakref ("Wf11c")));
+static ftype Wf11a __attribute__((weakref ("Wf11b")));
-extern ftype Wf12 __attribute__((weakref ("wf12")));
+static ftype Wf12 __attribute__((weakref ("wf12")));
extern ftype wf12 __attribute__((weak));
-extern ftype Wf13 __attribute__((weakref ("wf13")));
+static ftype Wf13 __attribute__((weakref ("wf13")));
extern ftype wf13 __attribute__((weak));
-extern ftype Wf14a __attribute__((weakref ("wf14")));
-extern ftype Wf14b __attribute__((weakref ("wf14")));
+static ftype Wf14a __attribute__((weakref ("wf14")));
+static ftype Wf14b __attribute__((weakref ("wf14")));
extern ftype wf14 __attribute__((weak));
+#ifndef __APPLE__
#define chk(p) do { if (!p) abort (); } while (0)
+#else
+#define chk(p) /* */
+#endif
int main () {
chk (!pv1a);
- chk (!pv1b);
- chk (!pv1c);
chk (pv2a);
chk (pv3a);
chk (pv4a);
@@ -203,7 +200,6 @@ int main () {
chk (!&Wv14a);
chk (!pf1a);
- chk (!pf1b);
chk (!pf1c);
chk (pf2a);
chk (pf3a);
diff --git a/gcc/testsuite/gcc.dg/attr-weakref-1b.c b/gcc/testsuite/gcc.dg/attr-weakref-1b.c
new file mode 100644
index 00000000000..c2c43898c84
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/attr-weakref-1b.c
@@ -0,0 +1,20 @@
+/* On Darwin, you have to have a definition of the function to link,
+ even if later on it won't be present in some dylib. (That is,
+ you have to link with the latest version of the dylib.) */
+void wf1(void) { }
+void wf6(void) { }
+void wf9(void) { }
+void wf10(void) { }
+void wf11(void) { }
+void wf12(void) { }
+void wf13(void) { }
+void wf14(void) { }
+
+int wv1;
+int wv6;
+int wv9;
+int wv10;
+int wv11;
+int wv12;
+int wv13;
+int wv14;
diff --git a/gcc/testsuite/gcc.dg/attr-weakref-2.c b/gcc/testsuite/gcc.dg/attr-weakref-2.c
new file mode 100644
index 00000000000..75cc0779c57
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/attr-weakref-2.c
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+/* { dg-require-weak "" } */
+
+typedef int vtype;
+
+extern vtype wv1;
+extern vtype Wv1a __attribute__((weakref ("wv1"))); /* { dg-error "weakref 'Wv1a' must have static linkage" } */
diff --git a/gcc/testsuite/gcc.dg/builtins-20.c b/gcc/testsuite/gcc.dg/builtins-20.c
index dbcf96c3c07..a8ada8a8606 100644
--- a/gcc/testsuite/gcc.dg/builtins-20.c
+++ b/gcc/testsuite/gcc.dg/builtins-20.c
@@ -39,6 +39,12 @@ void test1(double x)
if (cos(x)*tan(x) != sin(x))
link_error ();
+
+ if (sin(x)/tan(x) != cos(x))
+ link_error ();
+
+ if (tan(x)/sin(x) != 1.0/cos(x))
+ link_error ();
}
void test2(double x, double y)
@@ -67,6 +73,12 @@ void test1f(float x)
if (cosf(x)*tanf(x) != sinf(x))
link_error ();
+
+ if (sinf(x)/tanf(x) != cosf(x))
+ link_error ();
+
+ if (tanf(x)/sinf(x) != 1.0f/cosf(x))
+ link_error ();
#endif
}
@@ -97,6 +109,12 @@ void test1l(long double x)
if (cosl(x)*tanl(x) != sinl(x))
link_error ();
+
+ if (sinl(x)/tanl(x) != cosl(x))
+ link_error ();
+
+ if (tanl(x)/sinl(x) != 1.0l/cosl(x))
+ link_error ();
#endif
}
diff --git a/gcc/testsuite/gcc.dg/c90-const-expr-4.c b/gcc/testsuite/gcc.dg/c90-const-expr-4.c
new file mode 100644
index 00000000000..6a449870ed3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c90-const-expr-4.c
@@ -0,0 +1,11 @@
+/* Test for constant expressions: const variable with value 0 is not a
+ null pointer constant so the conditional expression should have
+ type void * and the assignment is OK. */
+/* Origin: Joseph Myers <joseph@codesourcery.com> */
+/* { dg-do compile } */
+/* { dg-options "-std=iso9899:1990 -O2" } */
+int *p;
+long *q;
+static void *const n = 0;
+int j;
+void f(void) { q = j ? p : n; }
diff --git a/gcc/testsuite/gcc.dg/c90-const-expr-5.c b/gcc/testsuite/gcc.dg/c90-const-expr-5.c
new file mode 100644
index 00000000000..132932b565a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c90-const-expr-5.c
@@ -0,0 +1,39 @@
+/* Test null pointer constants: typedefs for void should be OK but not
+ qualified void. */
+/* Origin: Joseph Myers <joseph@codesourcery.com> */
+/* { dg-do compile } */
+/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */
+
+typedef void V;
+int *p;
+long *q;
+int j;
+void (*fp)(void);
+
+void
+f (void)
+{
+ /* (V *)0 is a null pointer constant, so the assignment should be
+ diagnosed. */
+ q = (j ? p : (V *)0); /* { dg-error "error: assignment from incompatible pointer type" } */
+ q = (j ? p : (void *)0); /* { dg-error "error: assignment from incompatible pointer type" } */
+ /* And this conversion should be valid. */
+ (void (*)(void))(V *)0;
+ (void (*)(void))(void *)0;
+ /* Pointers to qualified void are not valid null pointer
+ constants. */
+ fp = (const void *)0; /* { dg-error "error: ISO C forbids assignment between function pointer and 'void \\*'" } */
+ fp = (void *)0;
+ fp = (V *)0;
+ fp = 0;
+ fp == 0;
+ 0 == fp;
+ fp == (void *)0;
+ (void *)0 == fp;
+ fp == (V *)0;
+ (V *)0 == fp;
+ fp == (V *)1; /* { dg-error "error: ISO C forbids comparison of 'void \\*' with function pointer" } */
+ (V *)1 == fp; /* { dg-error "error: ISO C forbids comparison of 'void \\*' with function pointer" } */
+ fp == (const void *)0; /* { dg-error "error: ISO C forbids comparison of 'void \\*' with function pointer" } */
+ (const void *)0 == fp; /* { dg-error "error: ISO C forbids comparison of 'void \\*' with function pointer" } */
+}
diff --git a/gcc/testsuite/gcc.dg/c99-const-expr-4.c b/gcc/testsuite/gcc.dg/c99-const-expr-4.c
new file mode 100644
index 00000000000..f6beaf77a04
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c99-const-expr-4.c
@@ -0,0 +1,11 @@
+/* Test for constant expressions: const variable with value 0 is not a
+ null pointer constant so the conditional expression should have
+ type void * and the assignment is OK. */
+/* Origin: Joseph Myers <joseph@codesourcery.com> */
+/* { dg-do compile } */
+/* { dg-options "-std=iso9899:1999 -O2" } */
+int *p;
+long *q;
+static void *const n = 0;
+int j;
+void f(void) { q = j ? p : n; }
diff --git a/gcc/testsuite/gcc.dg/c99-const-expr-5.c b/gcc/testsuite/gcc.dg/c99-const-expr-5.c
new file mode 100644
index 00000000000..e7fdf2c644b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c99-const-expr-5.c
@@ -0,0 +1,39 @@
+/* Test null pointer constants: typedefs for void should be OK but not
+ qualified void. */
+/* Origin: Joseph Myers <joseph@codesourcery.com> */
+/* { dg-do compile } */
+/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */
+
+typedef void V;
+int *p;
+long *q;
+int j;
+void (*fp)(void);
+
+void
+f (void)
+{
+ /* (V *)0 is a null pointer constant, so the assignment should be
+ diagnosed. */
+ q = (j ? p : (V *)0); /* { dg-error "error: assignment from incompatible pointer type" } */
+ q = (j ? p : (void *)0); /* { dg-error "error: assignment from incompatible pointer type" } */
+ /* And this conversion should be valid. */
+ (void (*)(void))(V *)0;
+ (void (*)(void))(void *)0;
+ /* Pointers to qualified void are not valid null pointer
+ constants. */
+ fp = (const void *)0; /* { dg-error "error: ISO C forbids assignment between function pointer and 'void \\*'" } */
+ fp = (void *)0;
+ fp = (V *)0;
+ fp = 0;
+ fp == 0;
+ 0 == fp;
+ fp == (void *)0;
+ (void *)0 == fp;
+ fp == (V *)0;
+ (V *)0 == fp;
+ fp == (V *)1; /* { dg-error "error: ISO C forbids comparison of 'void \\*' with function pointer" } */
+ (V *)1 == fp; /* { dg-error "error: ISO C forbids comparison of 'void \\*' with function pointer" } */
+ fp == (const void *)0; /* { dg-error "error: ISO C forbids comparison of 'void \\*' with function pointer" } */
+ (const void *)0 == fp; /* { dg-error "error: ISO C forbids comparison of 'void \\*' with function pointer" } */
+}
diff --git a/gcc/testsuite/gcc.dg/cast-pretty-print-1.c b/gcc/testsuite/gcc.dg/cast-pretty-print-1.c
new file mode 100644
index 00000000000..e5ecec1a096
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/cast-pretty-print-1.c
@@ -0,0 +1,12 @@
+/* Test pretty-printing of casts. Should not depend on whether
+ NOP_EXPR or CONVERT_EXPR is used. */
+/* Origin: Joseph Myers <joseph@codesourcery.com> */
+/* { dg-do compile } */
+/* { dg-options "" } */
+int i;
+void
+f (void)
+{
+ ((unsigned int)i)(); /* { dg-error "error: called object '\\(unsigned int\\)i' is not a function" } */
+ ((char)i)(); /* { dg-error "error: called object '\\(char\\)i' is not a function" } */
+}
diff --git a/gcc/testsuite/gcc.dg/charset/builtin2.c b/gcc/testsuite/gcc.dg/charset/builtin2.c
new file mode 100644
index 00000000000..bfe9a20e25b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/charset/builtin2.c
@@ -0,0 +1,32 @@
+/* Ensure that transformations of *printf are performed correctly
+ regardless of -fexec-charset. See PR 25120. */
+
+/* { dg-do compile } */
+/* { dg-require-iconv "IBM1047" } */
+/* { dg-options "-O2 -fexec-charset=IBM1047" } */
+/* { dg-final { scan-assembler-not "printf" } } */
+/* { dg-final { scan-assembler-not "fprintf" } } */
+/* { dg-final { scan-assembler-not "sprintf" } } */
+
+#include <stdio.h>
+
+void foo (char *dst, const char *src)
+{
+ printf ("\n");
+ printf ("hello world\n");
+ printf ("%s", "\n");
+ printf ("%s", "hello world\n");
+ printf ("%c", '\n');
+ printf ("%s\n", "hello world");
+ printf ("%s\n", src);
+
+ fprintf (stdout, "\n");
+ fprintf (stdout, "hello world\n");
+ fprintf (stdout, "%s", "\n");
+ fprintf (stdout, "%s", "hello world\n");
+ fprintf (stdout, "%c", '\n');
+ fprintf (stdout, "%s", src);
+
+ sprintf (dst, "hello world\n");
+ sprintf (dst, "%s", src);
+}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-layout-1_generate.c b/gcc/testsuite/gcc.dg/compat/struct-layout-1_generate.c
index 1fb8f6bec0e..2f69575cb72 100644
--- a/gcc/testsuite/gcc.dg/compat/struct-layout-1_generate.c
+++ b/gcc/testsuite/gcc.dg/compat/struct-layout-1_generate.c
@@ -723,7 +723,7 @@ int main (void)\n\
fprintf (outfile, "\
/* { dg-options \"-w -I%s\" } */\n\
/* { dg-options \"-w -I%s -fno-common\" { target hppa*-*-hpux* } } */\n\
-/* { dg-options \"-I%s -mno-base-addresses\" { target mmix-*-* } } */\n\
+/* { dg-options \"-w -I%s -mno-base-addresses\" { target mmix-*-* } } */\n\
#include \"struct-layout-1_x1.h\"\n\
#include \"t%03d_test.h\"\n\
#include \"struct-layout-1_x2.h\"\n\
@@ -736,7 +736,7 @@ int main (void)\n\
fprintf (outfile, "\
/* { dg-options \"-w -I%s\" } */\n\
/* { dg-options \"-w -I%s -fno-common\" { target hppa*-*-hpux* } } */\n\
-/* { dg-options \"-I%s -mno-base-addresses\" { target mmix-*-* } } */\n\
+/* { dg-options \"-w -I%s -mno-base-addresses\" { target mmix-*-* } } */\n\
#include \"struct-layout-1_y1.h\"\n\
#include \"t%03d_test.h\"\n\
#include \"struct-layout-1_y2.h\"\n\
diff --git a/gcc/testsuite/gcc.dg/darwin-weakimport-3.c b/gcc/testsuite/gcc.dg/darwin-weakimport-3.c
new file mode 100644
index 00000000000..de6458c7398
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/darwin-weakimport-3.c
@@ -0,0 +1,10 @@
+/* { dg-do compile { target *-*-darwin* } } */
+/* { dg-require-weak "" } */
+
+/* { dg-final { scan-assembler-not "coalesced" } } */
+
+extern void foo(void) __attribute__((weak_import));
+
+void foo(void)
+{
+}
diff --git a/gcc/testsuite/gcc.dg/darwin-weakref-1.c b/gcc/testsuite/gcc.dg/darwin-weakref-1.c
new file mode 100644
index 00000000000..22a3cc079a8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/darwin-weakref-1.c
@@ -0,0 +1,28 @@
+/* { dg-do compile { target *-*-darwin* } } */
+// { dg-require-weak "" }
+// { dg-options "-O2" }
+// { dg-options "-O2 -mmacosx-version-min=10.2" { target { powerpc-*-darwin* } } }
+/* { dg-final { scan-assembler "weak_reference _wv1" } } */
+/* { dg-final { scan-assembler "weak_reference _wf1" } } */
+/* { dg-final { scan-assembler-not "weak_reference _w.2" } } */
+
+
+typedef int vtype;
+
+extern vtype wv1;
+static vtype Wv1a __attribute__((weakref ("wv1")));
+vtype *pv1a = &Wv1a;
+
+extern vtype wv2;
+static vtype Wv2a __attribute__((weakref ("wv2")));
+vtype *pv2a = &wv2;
+
+typedef void ftype(void);
+
+extern ftype wf1;
+static ftype Wf1a __attribute__((weakref ("wf1")));
+ftype *pf1a = &Wf1a;
+
+extern ftype wf2;
+static ftype Wf2a __attribute__((weakref ("wf2")));
+ftype *pf2a = &wf2;
diff --git a/gcc/testsuite/gcc.dg/format/cast-1.c b/gcc/testsuite/gcc.dg/format/cast-1.c
new file mode 100644
index 00000000000..78a4f527d9b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/format/cast-1.c
@@ -0,0 +1,16 @@
+/* Test for strings cast through integer types: should not be treated
+ as format strings unless the types are of the same width as
+ pointers (intptr_t or similar). */
+/* Origin: Joseph Myers <joseph@codesourcery.com> */
+/* { dg-do compile } */
+/* { dg-options "-Wformat" } */
+
+#include "format.h"
+
+void
+f (int x)
+{
+ printf("%s", x); /* { dg-warning "format" } */
+ printf((char *)(size_t)"%s", x); /* { dg-warning "format" } */
+ printf((char *)(char)"%s", x);
+}
diff --git a/gcc/testsuite/gcc.dg/lvalue-2.c b/gcc/testsuite/gcc.dg/lvalue-2.c
index 5ad648eece9..c512aef8394 100644
--- a/gcc/testsuite/gcc.dg/lvalue-2.c
+++ b/gcc/testsuite/gcc.dg/lvalue-2.c
@@ -9,12 +9,12 @@ int a, b;
void
f0 (void)
{
- (a+b) = 1; /* { dg-error "error: invalid lvalue in assignment" } */
- (a+b)++; /* { dg-error "error: invalid lvalue in increment" } */
- ++(a+b); /* { dg-error "error: invalid lvalue in increment" } */
- (a+b)--; /* { dg-error "error: invalid lvalue in decrement" } */
- --(a+b); /* { dg-error "error: invalid lvalue in decrement" } */
- &(a+b); /* { dg-error "error: invalid lvalue in unary '&'" } */
+ (a+b) = 1; /* { dg-error "error: lvalue required as left operand of assignment" } */
+ (a+b)++; /* { dg-error "error: lvalue required as increment operand" } */
+ ++(a+b); /* { dg-error "error: lvalue required as increment operand" } */
+ (a+b)--; /* { dg-error "error: lvalue required as decrement operand" } */
+ --(a+b); /* { dg-error "error: lvalue required as decrement operand" } */
+ &(a+b); /* { dg-error "error: lvalue required as unary '&' operand" } */
}
const int c;
diff --git a/gcc/testsuite/gcc.dg/lvalue1.c b/gcc/testsuite/gcc.dg/lvalue1.c
index 7e21608ab36..67b013078c8 100644
--- a/gcc/testsuite/gcc.dg/lvalue1.c
+++ b/gcc/testsuite/gcc.dg/lvalue1.c
@@ -4,6 +4,6 @@
int main()
{
int i;
- +i = 1; /* { dg-error "invalid lvalue in assignment" } */
+ +i = 1; /* { dg-error "lvalue required as left operand of assignment" } */
return 0;
}
diff --git a/gcc/testsuite/gcc.dg/nest.c b/gcc/testsuite/gcc.dg/nest.c
index 89ecdd58a06..b9476600ae2 100644
--- a/gcc/testsuite/gcc.dg/nest.c
+++ b/gcc/testsuite/gcc.dg/nest.c
@@ -4,7 +4,6 @@
/* { dg-options "-O2 -pg" } */
/* { dg-options "-O2 -pg -static" { target hppa*-*-hpux* } } */
/* { dg-error "profiler" "No profiler support" { target xstormy16-*-* } 0 } */
-/* { dg-error "-pg not supported" "Profiler support missing" { target *-*-sco3.2v5* } 0 } */
/* { dg-bogus "\[Uu\]nresolved symbol ._mcount" "Profiling unsupported" { xfail *-*-netware* } 0 } */
extern void abort (void);
diff --git a/gcc/testsuite/gcc.dg/pr17112-1.c b/gcc/testsuite/gcc.dg/pr17112-1.c
index 7c8b7aa0432..09c3758abed 100644
--- a/gcc/testsuite/gcc.dg/pr17112-1.c
+++ b/gcc/testsuite/gcc.dg/pr17112-1.c
@@ -5,7 +5,7 @@
extern void abort(void);
typedef struct {
- int int24:24 __attribute__ ((packed));
+ int int24:24 __attribute__ ((packed)); /* { dg-warning "attribute ignored" "" { target { default_packed && { ! pcc_bitfield_type_matters } } } } */
} myint24;
myint24 x[3] = {
diff --git a/gcc/testsuite/gcc.dg/pr17730-1.c b/gcc/testsuite/gcc.dg/pr17730-1.c
index 0fede2f6d6c..fe9be68eff6 100644
--- a/gcc/testsuite/gcc.dg/pr17730-1.c
+++ b/gcc/testsuite/gcc.dg/pr17730-1.c
@@ -2,4 +2,4 @@
/* { dg-do compile } */
/* { dg-options "" } */
-char *p = &'C'; /* { dg-error "error: invalid lvalue in unary '&'" } */
+char *p = &'C'; /* { dg-error "error: lvalue required as unary '&' operand" } */
diff --git a/gcc/testsuite/gcc.dg/tls/alias-1.c b/gcc/testsuite/gcc.dg/tls/alias-1.c
index 1098190ebd0..28cb47e5041 100644
--- a/gcc/testsuite/gcc.dg/tls/alias-1.c
+++ b/gcc/testsuite/gcc.dg/tls/alias-1.c
@@ -1,6 +1,7 @@
/* { dg-do link } */
/* { dg-require-alias "" } */
/* { dg-require-visibility "" } */
+/* { dg-require-effective-target tls } */
/* Test that encode_section_info handles the change from externally
defined to locally defined (via hidden). Extracted from glibc. */
diff --git a/gcc/testsuite/gcc.dg/tls/alpha-1.c b/gcc/testsuite/gcc.dg/tls/alpha-1.c
index 4bb911f74a1..1d15cb1681c 100644
--- a/gcc/testsuite/gcc.dg/tls/alpha-1.c
+++ b/gcc/testsuite/gcc.dg/tls/alpha-1.c
@@ -1,6 +1,7 @@
/* Make sure that we honor initial-exec. */
/* { dg-do compile { target alpha*-*-* } } */
/* { dg-options "" } */
+/* { dg-require-effective-target tls } */
static __thread int xyzzy __attribute__ ((tls_model ("initial-exec")));
int foo(void) { return xyzzy; }
diff --git a/gcc/testsuite/gcc.dg/tls/asm-1.c b/gcc/testsuite/gcc.dg/tls/asm-1.c
index 476fe7cbb72..b77e550d7bf 100644
--- a/gcc/testsuite/gcc.dg/tls/asm-1.c
+++ b/gcc/testsuite/gcc.dg/tls/asm-1.c
@@ -1,4 +1,5 @@
/* { dg-options "-Werror" } */
+/* { dg-require-effective-target tls } */
__thread int i;
int foo ()
diff --git a/gcc/testsuite/gcc.dg/tls/debug-1.c b/gcc/testsuite/gcc.dg/tls/debug-1.c
index 719f0645771..67d7be69cc5 100644
--- a/gcc/testsuite/gcc.dg/tls/debug-1.c
+++ b/gcc/testsuite/gcc.dg/tls/debug-1.c
@@ -1,4 +1,5 @@
/* { dg-do assemble } */
/* { dg-options "-g" } */
+/* { dg-require-effective-target tls } */
__thread int i;
diff --git a/gcc/testsuite/gcc.dg/tls/diag-1.c b/gcc/testsuite/gcc.dg/tls/diag-1.c
index ae4f3d4a3c2..56b570c94a5 100644
--- a/gcc/testsuite/gcc.dg/tls/diag-1.c
+++ b/gcc/testsuite/gcc.dg/tls/diag-1.c
@@ -1,4 +1,5 @@
/* Valid __thread specifiers. */
+/* { dg-require-effective-target tls } */
__thread int g1;
extern __thread int g2;
diff --git a/gcc/testsuite/gcc.dg/tls/diag-2.c b/gcc/testsuite/gcc.dg/tls/diag-2.c
index 5e7e17bee5a..8276cb3be49 100644
--- a/gcc/testsuite/gcc.dg/tls/diag-2.c
+++ b/gcc/testsuite/gcc.dg/tls/diag-2.c
@@ -1,4 +1,5 @@
/* Invalid __thread specifiers. */
+/* { dg-require-effective-target tls } */
__thread extern int g1; /* { dg-error "'__thread' before 'extern'" } */
__thread static int g2; /* { dg-error "'__thread' before 'static'" } */
diff --git a/gcc/testsuite/gcc.dg/tls/diag-3.c b/gcc/testsuite/gcc.dg/tls/diag-3.c
index f1ce06b70d8..45d89b43722 100644
--- a/gcc/testsuite/gcc.dg/tls/diag-3.c
+++ b/gcc/testsuite/gcc.dg/tls/diag-3.c
@@ -1,4 +1,5 @@
/* Report invalid extern and __thread combinations. */
+/* { dg-require-effective-target tls } */
extern int j; /* { dg-error "previous declaration" } */
__thread int j; /* { dg-error "follows non-thread-local" } */
diff --git a/gcc/testsuite/gcc.dg/tls/diag-4.c b/gcc/testsuite/gcc.dg/tls/diag-4.c
index df3705d04ee..fed2f3accd3 100644
--- a/gcc/testsuite/gcc.dg/tls/diag-4.c
+++ b/gcc/testsuite/gcc.dg/tls/diag-4.c
@@ -1,5 +1,6 @@
/* Invalid __thread specifiers. As diag-4.c but some cases in
different orders. */
+/* { dg-require-effective-target tls } */
__thread typedef int g4; /* { dg-error "'__thread' used with 'typedef'" } */
diff --git a/gcc/testsuite/gcc.dg/tls/diag-5.c b/gcc/testsuite/gcc.dg/tls/diag-5.c
index 623832c3812..219396d768a 100644
--- a/gcc/testsuite/gcc.dg/tls/diag-5.c
+++ b/gcc/testsuite/gcc.dg/tls/diag-5.c
@@ -1,3 +1,4 @@
/* __thread specifiers on empty declarations. */
+/* { dg-require-effective-target tls } */
__thread struct foo; /* { dg-warning "warning: useless '__thread' in empty declaration" } */
diff --git a/gcc/testsuite/gcc.dg/tls/init-1.c b/gcc/testsuite/gcc.dg/tls/init-1.c
index 97258643bf2..fa4208dce0c 100644
--- a/gcc/testsuite/gcc.dg/tls/init-1.c
+++ b/gcc/testsuite/gcc.dg/tls/init-1.c
@@ -1,4 +1,5 @@
/* Invalid initializations. */
+/* { dg-require-effective-target tls } */
extern __thread int i;
int *p = &i; /* { dg-error "initializer element is not constant" } */
diff --git a/gcc/testsuite/gcc.dg/tls/nonpic-1.c b/gcc/testsuite/gcc.dg/tls/nonpic-1.c
index 0896df60b56..9c592a98556 100644
--- a/gcc/testsuite/gcc.dg/tls/nonpic-1.c
+++ b/gcc/testsuite/gcc.dg/tls/nonpic-1.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2 -ftls-model=initial-exec" } */
+/* { dg-require-effective-target tls } */
extern __thread long e1;
extern __thread int e2;
diff --git a/gcc/testsuite/gcc.dg/tls/opt-1.c b/gcc/testsuite/gcc.dg/tls/opt-1.c
index f7dcceee7c8..5bada6e0929 100644
--- a/gcc/testsuite/gcc.dg/tls/opt-1.c
+++ b/gcc/testsuite/gcc.dg/tls/opt-1.c
@@ -2,6 +2,7 @@
/* { dg-options "-O2 -fPIC" } */
/* { dg-options "-O2 -fPIC -mtune=i686" { target { i?86-*-* && ilp32 } } } */
/* { dg-options "-O2 -fPIC -mtune=i686" { target { x86_64-*-* && ilp32 } } } */
+/* { dg-require-effective-target tls } */
extern __thread int thr;
diff --git a/gcc/testsuite/gcc.dg/tls/opt-10.c b/gcc/testsuite/gcc.dg/tls/opt-10.c
index f31c1fff816..a710a062ca3 100644
--- a/gcc/testsuite/gcc.dg/tls/opt-10.c
+++ b/gcc/testsuite/gcc.dg/tls/opt-10.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O3 -fpic" } */
+/* { dg-require-effective-target tls } */
/* The web pass was creating unrecognisable pic_load_dot_plus_four insns
on ARM. */
diff --git a/gcc/testsuite/gcc.dg/tls/opt-11.c b/gcc/testsuite/gcc.dg/tls/opt-11.c
new file mode 100644
index 00000000000..3739645257a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tls/opt-11.c
@@ -0,0 +1,33 @@
+/* { dg-do run } */
+/* { dg-require-effective-target tls_runtime } */
+
+extern void abort (void);
+extern void *memset (void *, int, __SIZE_TYPE__);
+
+struct A
+{
+ char pad[48];
+ int i;
+ int pad2;
+ int j;
+};
+__thread struct A a;
+
+int *
+__attribute__((noinline))
+foo (void)
+{
+ return &a.i;
+}
+
+int
+main (void)
+{
+ int *p = foo ();
+ memset (&a, 0, sizeof (a));
+ a.i = 6;
+ a.j = 8;
+ if (p[0] != 6 || p[1] != 0 || p[2] != 8)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/tls/opt-2.c b/gcc/testsuite/gcc.dg/tls/opt-2.c
index dde54f00674..fd781ebabd1 100644
--- a/gcc/testsuite/gcc.dg/tls/opt-2.c
+++ b/gcc/testsuite/gcc.dg/tls/opt-2.c
@@ -6,6 +6,7 @@
/* { dg-options "-O2 -ftls-model=initial-exec" } */
/* { dg-options "-O2 -ftls-model=initial-exec -march=i686" { target { i?86-*-* && ilp32 } } } */
/* { dg-options "-O2 -ftls-model=initial-exec -march=i686" { target { x86_64-*-* && ilp32 } } } */
+/* { dg-require-effective-target tls } */
__thread int thr;
diff --git a/gcc/testsuite/gcc.dg/tls/opt-3.c b/gcc/testsuite/gcc.dg/tls/opt-3.c
index 8e476f657e8..e59e5110b5b 100644
--- a/gcc/testsuite/gcc.dg/tls/opt-3.c
+++ b/gcc/testsuite/gcc.dg/tls/opt-3.c
@@ -1,6 +1,7 @@
/* { dg-do compile } */
/* { dg-options "-O2 -fpic" } */
/* { dg-options "-O2 -fpic -mregparm=3" { target i?86-*-* } } */
+/* { dg-require-effective-target tls } */
extern __thread int i, j, k;
extern void bar(int *, int *, int *);
diff --git a/gcc/testsuite/gcc.dg/tls/opt-4.c b/gcc/testsuite/gcc.dg/tls/opt-4.c
index 3a95688963b..aa59ee7fabf 100644
--- a/gcc/testsuite/gcc.dg/tls/opt-4.c
+++ b/gcc/testsuite/gcc.dg/tls/opt-4.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2" } */
+/* { dg-require-effective-target tls } */
struct A
{
diff --git a/gcc/testsuite/gcc.dg/tls/opt-5.c b/gcc/testsuite/gcc.dg/tls/opt-5.c
index d8a686ddb46..0604f3253c1 100644
--- a/gcc/testsuite/gcc.dg/tls/opt-5.c
+++ b/gcc/testsuite/gcc.dg/tls/opt-5.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2" } */
+/* { dg-require-effective-target tls } */
/* Sched1 moved {load_tp} pattern between strlen call and the copy
of the hard return value to its pseudo. This resulted in a
reload abort, since the hard register was not spillable. */
diff --git a/gcc/testsuite/gcc.dg/tls/opt-6.c b/gcc/testsuite/gcc.dg/tls/opt-6.c
index de04c1cb3fc..8a01c019c10 100644
--- a/gcc/testsuite/gcc.dg/tls/opt-6.c
+++ b/gcc/testsuite/gcc.dg/tls/opt-6.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2" } */
+/* { dg-require-effective-target tls } */
extern void abort (void);
extern void exit (int);
diff --git a/gcc/testsuite/gcc.dg/tls/opt-7.c b/gcc/testsuite/gcc.dg/tls/opt-7.c
index beb2c2622d4..c345068a203 100644
--- a/gcc/testsuite/gcc.dg/tls/opt-7.c
+++ b/gcc/testsuite/gcc.dg/tls/opt-7.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2 -fPIC" } */
+/* { dg-require-effective-target tls } */
static __thread void *baz [4] __attribute__((tls_model ("initial-exec")));
void foo (void)
diff --git a/gcc/testsuite/gcc.dg/tls/opt-8.c b/gcc/testsuite/gcc.dg/tls/opt-8.c
index dec0eabcb4c..a7331115352 100644
--- a/gcc/testsuite/gcc.dg/tls/opt-8.c
+++ b/gcc/testsuite/gcc.dg/tls/opt-8.c
@@ -1,6 +1,7 @@
/* PR 18910 */
/* { dg-do compile } */
/* { dg-options "-O2" } */
+/* { dg-require-effective-target tls } */
static __thread void *foo [2];
void
diff --git a/gcc/testsuite/gcc.dg/tls/opt-9.c b/gcc/testsuite/gcc.dg/tls/opt-9.c
index 3829c66fc55..cc62ef57a5d 100644
--- a/gcc/testsuite/gcc.dg/tls/opt-9.c
+++ b/gcc/testsuite/gcc.dg/tls/opt-9.c
@@ -1,6 +1,7 @@
/* PR 21412 */
/* { dg-do compile */
/* { dg-options "-O2 -fPIC" } */
+/* { dg-require-effective-target tls } */
struct S { int x[10]; };
extern __thread struct S s;
diff --git a/gcc/testsuite/gcc.dg/tls/pic-1.c b/gcc/testsuite/gcc.dg/tls/pic-1.c
index f5b020b7db6..bcd42bd8572 100644
--- a/gcc/testsuite/gcc.dg/tls/pic-1.c
+++ b/gcc/testsuite/gcc.dg/tls/pic-1.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2 -fpic -ftls-model=global-dynamic" } */
+/* { dg-require-effective-target tls } */
extern __thread long e1;
extern __thread int e2;
diff --git a/gcc/testsuite/gcc.dg/tls/pr24428-2.c b/gcc/testsuite/gcc.dg/tls/pr24428-2.c
index 828943c60e5..a0ceecc0624 100644
--- a/gcc/testsuite/gcc.dg/tls/pr24428-2.c
+++ b/gcc/testsuite/gcc.dg/tls/pr24428-2.c
@@ -1,5 +1,6 @@
/* { dg-do run } */
/* { dg-options "-O2" } */
+/* { dg-require-effective-target tls_runtime } */
__thread double thrtest[81];
int main ()
diff --git a/gcc/testsuite/gcc.dg/tls/pr24428.c b/gcc/testsuite/gcc.dg/tls/pr24428.c
index 53b1245d509..ecb747ede6d 100644
--- a/gcc/testsuite/gcc.dg/tls/pr24428.c
+++ b/gcc/testsuite/gcc.dg/tls/pr24428.c
@@ -1,5 +1,6 @@
/* { dg-do run } */
/* { dg-options "-O2" } */
+/* { dg-require-effective-target tls_runtime } */
__thread double thrtest[81];
int main ()
diff --git a/gcc/testsuite/gcc.dg/tls/section-1.c b/gcc/testsuite/gcc.dg/tls/section-1.c
index 741eadba536..4fc5066b90d 100644
--- a/gcc/testsuite/gcc.dg/tls/section-1.c
+++ b/gcc/testsuite/gcc.dg/tls/section-1.c
@@ -1,5 +1,6 @@
/* Verify that we get errors for trying to put TLS data in
sections which can't work. */
+/* { dg-require-effective-target tls } */
#define A(X) __attribute__((section(X)))
diff --git a/gcc/testsuite/gcc.dg/tls/struct-1.c b/gcc/testsuite/gcc.dg/tls/struct-1.c
index 11151236d90..5fd6be43905 100644
--- a/gcc/testsuite/gcc.dg/tls/struct-1.c
+++ b/gcc/testsuite/gcc.dg/tls/struct-1.c
@@ -2,6 +2,7 @@
to allow addends for @dtpoff relocs or not. */
/* { dg-do compile } */
/* { dg-options "-O2 -fpic" } */
+/* { dg-require-effective-target tls } */
struct S {
int s0, s1, s2, s3;
diff --git a/gcc/testsuite/gcc.dg/tls/tls.exp b/gcc/testsuite/gcc.dg/tls/tls.exp
index b168a1e6190..cd86231c050 100644
--- a/gcc/testsuite/gcc.dg/tls/tls.exp
+++ b/gcc/testsuite/gcc.dg/tls/tls.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2002 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2005 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -19,16 +19,6 @@
# Load support procs.
load_lib gcc-dg.exp
-# Test for thread-local data supported by the platform. If it
-# isn't, everything will fail with the "not supported" message.
-
-set comp_output [gcc_target_compile \
- "$srcdir/$subdir/trivial.c" "trivial.S" assembly ""]
-remove-build-file "trivial.S"
-if { [string match "*not supported*" $comp_output] } {
- return 0
-}
-
# If a testcase doesn't have special options, use these.
global DEFAULT_CFLAGS
if ![info exists DEFAULT_CFLAGS] then {
diff --git a/gcc/testsuite/gcc.dg/tls/trivial.c b/gcc/testsuite/gcc.dg/tls/trivial.c
index 1fd70631f33..96b8e49a665 100644
--- a/gcc/testsuite/gcc.dg/tls/trivial.c
+++ b/gcc/testsuite/gcc.dg/tls/trivial.c
@@ -1 +1,3 @@
+/* { dg-require-effective-target tls } */
+
__thread int i;
diff --git a/gcc/testsuite/gcc.dg/torture/fp-int-convert-float128-timode.c b/gcc/testsuite/gcc.dg/torture/fp-int-convert-float128-timode.c
index 30250d86d9e..e9538318f69 100644
--- a/gcc/testsuite/gcc.dg/torture/fp-int-convert-float128-timode.c
+++ b/gcc/testsuite/gcc.dg/torture/fp-int-convert-float128-timode.c
@@ -2,6 +2,7 @@
/* Origin: Joseph Myers <joseph@codesourcery.com> */
/* { dg-do run { target i?86-*-* x86_64-*-* ia64-*-* } } */
/* { dg-xfail-if "" { i?86-*-* x86_64-*-* } { "*" } { "" } } */
+/* { dg-xfail-if "" { ia64-*-* && lp64 } { "*" } { "" } } */
/* { dg-options "" } */
/* { dg-options "-mmmx" { target { i?86-*-* && ilp32 } } } */
/* { dg-options "-mmmx" { target { x86_64-*-* && ilp32 } } } */
diff --git a/gcc/testsuite/gcc.dg/torture/fp-int-convert-timode.c b/gcc/testsuite/gcc.dg/torture/fp-int-convert-timode.c
index 11c02a321ca..e60b5409d5f 100644
--- a/gcc/testsuite/gcc.dg/torture/fp-int-convert-timode.c
+++ b/gcc/testsuite/gcc.dg/torture/fp-int-convert-timode.c
@@ -1,6 +1,6 @@
/* Test floating-point conversions. TImode types. */
/* Origin: Joseph Myers <joseph@codesourcery.com> */
-/* { dg-do run { xfail *-*-* } } */
+/* { dg-do run { xfail lp64 } } */
/* { dg-options "" } */
#include <float.h>
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/20031106-6.c b/gcc/testsuite/gcc.dg/tree-ssa/20031106-6.c
index 6d15c7b5053..8708fe12dcf 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/20031106-6.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/20031106-6.c
@@ -25,5 +25,5 @@ struct s foo (struct s r)
/* There should be no references to any of "temp_struct*"
temporaries. */
-/* { dg-final { scan-tree-dump-times "temp_struct" 0 "optimized" { xfail *-*-* } } } */
+/* { dg-final { scan-tree-dump-times "temp_struct" 0 "optimized" } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/divide-3.c b/gcc/testsuite/gcc.dg/tree-ssa/divide-3.c
new file mode 100644
index 00000000000..fa3e35a6a0b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/divide-3.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fdump-tree-optimized" } */
+
+int f(int a)
+{
+ return -(a/10);
+}
+
+/* { dg-final { scan-tree-dump-times "a / 10" 0 "optimized"} } */
+/* { dg-final { scan-tree-dump-times "a / -10" 1 "optimized"} } */
+
+/* { dg-final { cleanup-tree-dump "optimized" } } */
+
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/divide-4.c b/gcc/testsuite/gcc.dg/tree-ssa/divide-4.c
new file mode 100644
index 00000000000..38c68cf6e8d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/divide-4.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fdump-tree-optimized" } */
+
+int f(int a)
+{
+ return -(-a/10);
+}
+
+/* { dg-final { scan-tree-dump-times "-a / 10" 0 "optimized"} } */
+/* { dg-final { scan-tree-dump-times "a / 10" 1 "optimized"} } */
+
+/* { dg-final { cleanup-tree-dump "optimized" } } */
+
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dce-2.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dce-2.c
index 81a11a97bda..655f61c6f73 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dce-2.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dce-2.c
@@ -2,11 +2,11 @@
/* { dg-options "-O2 -fdump-tree-dce3" } */
/* We should notice constantness of this function. */
-int t(int a)
+static int __attribute__((noinline)) t(int a)
{
return a+1;
}
-q()
+void q(void)
{
int i = t(1);
if (!i)
diff --git a/gcc/testsuite/gcc.dg/vect/vect-62.c b/gcc/testsuite/gcc.dg/vect/vect-62.c
index 433b8bf3571..79f8876155e 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-62.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-62.c
@@ -66,5 +66,4 @@ int main (void)
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */
-/* { dg-final { scan-tree-dump-times "not vectorized: redundant loop. no profit to vectorize." 1 "vect" } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-76.c b/gcc/testsuite/gcc.dg/vect/vect-76.c
index 40213e80acf..8539b6036ee 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-76.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-76.c
@@ -69,7 +69,6 @@ int main (void)
}
-/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" { xfail vect_no_align } } } */
-/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_no_align } } } */
+/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" } } */
/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 2 "vect" { xfail vect_no_align } } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-1char.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-1char.c
index 418687dd23b..38bb91727c6 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-reduc-1char.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-1char.c
@@ -46,5 +46,5 @@ int main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" { xfail vect_no_int_max } } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-1short.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-1short.c
index 91d7abd1275..cb2293fe3df 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-reduc-1short.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-1short.c
@@ -46,5 +46,5 @@ int main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" { xfail vect_no_int_max } } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-2char.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-2char.c
index f8a7b96fbc9..aecf8a512e1 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-reduc-2char.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-2char.c
@@ -45,5 +45,5 @@ int main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" { xfail vect_no_int_max } } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-2short.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-2short.c
index d4ac128563c..4476c83d0e7 100644
--- a/gcc/testsuite/gcc.dg/vect/vect-reduc-2short.c
+++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-2short.c
@@ -44,5 +44,5 @@ int main (void)
return 0;
}
-/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" { xfail vect_no_int_max } } } */
/* { dg-final { cleanup-tree-dump "vect" } } */