summaryrefslogtreecommitdiff
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/Wpadded.c1
-rw-r--r--gcc/testsuite/gcc.dg/bf-ms-attrib.c2
-rw-r--r--gcc/testsuite/gcc.dg/bf-ms-layout-2.c16
-rw-r--r--gcc/testsuite/gcc.dg/bf-ms-layout-3.c52
-rw-r--r--gcc/testsuite/gcc.dg/di-sync-multithread.c7
-rw-r--r--gcc/testsuite/gcc.dg/format/dfp-printf-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/graphite/pr50561.c2
-rw-r--r--gcc/testsuite/gcc.dg/lto/pr52097_0.c20
-rw-r--r--gcc/testsuite/gcc.dg/lto/trans-mem-1_0.c14
-rw-r--r--gcc/testsuite/gcc.dg/lto/trans-mem-1_1.c1
-rw-r--r--gcc/testsuite/gcc.dg/lto/trans-mem-2_0.c16
-rw-r--r--gcc/testsuite/gcc.dg/lto/trans-mem-2_1.c4
-rw-r--r--gcc/testsuite/gcc.dg/lto/trans-mem-4_0.c13
-rw-r--r--gcc/testsuite/gcc.dg/lto/trans-mem-4_1.c6
-rw-r--r--gcc/testsuite/gcc.dg/noncompile/pr52290.c3
-rw-r--r--gcc/testsuite/gcc.dg/pack-test-5.c1
-rw-r--r--gcc/testsuite/gcc.dg/pr49544.c4
-rw-r--r--gcc/testsuite/gcc.dg/pr50251.c2
-rw-r--r--gcc/testsuite/gcc.dg/pr51721.c31
-rw-r--r--gcc/testsuite/gcc.dg/pr52132.c9
-rw-r--r--gcc/testsuite/gcc.dg/pr52318.c17
-rw-r--r--gcc/testsuite/gcc.dg/pr52355.c13
-rw-r--r--gcc/testsuite/gcc.dg/pr52445.c15
-rw-r--r--gcc/testsuite/gcc.dg/simulate-thread/atomic-load-int128.c7
-rw-r--r--gcc/testsuite/gcc.dg/simulate-thread/simulate-thread.gdb2
-rw-r--r--gcc/testsuite/gcc.dg/simulate-thread/simulate-thread.h44
-rw-r--r--gcc/testsuite/gcc.dg/simulate-thread/speculative-store.c1
-rw-r--r--gcc/testsuite/gcc.dg/stack-usage-1.c6
-rw-r--r--gcc/testsuite/gcc.dg/tls/opt-11.c4
-rw-r--r--gcc/testsuite/gcc.dg/tls/thr-cse-1.c3
-rw-r--r--gcc/testsuite/gcc.dg/tm/pr52141.c24
-rw-r--r--gcc/testsuite/gcc.dg/tm/pub-safety-1.c24
-rw-r--r--gcc/testsuite/gcc.dg/torture/builtin-complex-1.c6
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr47917.c1
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr52298.c16
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr52402.c30
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr52406.c29
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr52407.c33
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr52419.c32
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr52429.c24
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr52493.c38
-rw-r--r--gcc/testsuite/gcc.dg/torture/va-arg-25.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ipa-split-6.c10
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/phi-opt-8.c26
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/phi-opt-9.c21
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/scev-3.c18
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/scev-4.c23
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-10.c31
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp63.c345
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr46126.c10
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr52298.c31
51 files changed, 1001 insertions, 91 deletions
diff --git a/gcc/testsuite/gcc.dg/Wpadded.c b/gcc/testsuite/gcc.dg/Wpadded.c
index 9e69a9fef50..70fcd79a6d4 100644
--- a/gcc/testsuite/gcc.dg/Wpadded.c
+++ b/gcc/testsuite/gcc.dg/Wpadded.c
@@ -6,6 +6,7 @@
We won't get a warning anyway if the target has "packed" structure
layout. */
/* { dg-options "-Wpadded -fpack-struct=8" } */
+/* { dg-additional-options "-mno-ms-bitfields" { target *-*-mingw* } } */
struct foo {
char bar;
diff --git a/gcc/testsuite/gcc.dg/bf-ms-attrib.c b/gcc/testsuite/gcc.dg/bf-ms-attrib.c
index da4eb08d2da..d62da2ad525 100644
--- a/gcc/testsuite/gcc.dg/bf-ms-attrib.c
+++ b/gcc/testsuite/gcc.dg/bf-ms-attrib.c
@@ -32,7 +32,7 @@ main()
/* As long as the sizes are as expected, we know attributes are working.
bf-ms-layout.c makes sure the right thing happens when the attribute
is on. */
- if (sizeof(struct one_ms) != 12)
+ if (sizeof(struct one_ms) != 8)
abort();
if (sizeof(struct one_gcc) != 8)
abort();
diff --git a/gcc/testsuite/gcc.dg/bf-ms-layout-2.c b/gcc/testsuite/gcc.dg/bf-ms-layout-2.c
index 0bd472bc1f8..408ddbeb89e 100644
--- a/gcc/testsuite/gcc.dg/bf-ms-layout-2.c
+++ b/gcc/testsuite/gcc.dg/bf-ms-layout-2.c
@@ -158,27 +158,27 @@ int main(){
struct ten test_ten;
#if defined (_TEST_MS_LAYOUT) || defined (_MSC_VER)
- size_t exp_sizeof_one = 12;
- size_t exp_sizeof_two = 16;
+ size_t exp_sizeof_one = 8;
+ size_t exp_sizeof_two = 12;
size_t exp_sizeof_three =6;
size_t exp_sizeof_four = 8;
size_t exp_sizeof_five = 3;
size_t exp_sizeof_six = 8;
size_t exp_sizeof_seven = 3;
- size_t exp_sizeof_eight = 4;
+ size_t exp_sizeof_eight = 2;
size_t exp_sizeof_nine = 8;
- size_t exp_sizeof_ten = 16;
+ size_t exp_sizeof_ten = 8;
- unsigned char exp_one_c = 8;
- unsigned char exp_two_c = 12;
+ unsigned char exp_one_c = 7;
+ unsigned char exp_two_c = 9;
unsigned char exp_three_c = 4;
unsigned char exp_four_c = 4;
char exp_five_c = 2;
char exp_six_c = 5;
char exp_seven_c = 2;
- char exp_eight_c = 2;
+ char exp_eight_c = 1;
char exp_nine_c = 0;
- char exp_ten_c = 8;
+ char exp_ten_c = 1;
#else /* testing -mno-ms-bitfields */
diff --git a/gcc/testsuite/gcc.dg/bf-ms-layout-3.c b/gcc/testsuite/gcc.dg/bf-ms-layout-3.c
new file mode 100644
index 00000000000..a4e9ab3ff6f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/bf-ms-layout-3.c
@@ -0,0 +1,52 @@
+/* Test for MS bitfield layout */
+/* { dg-do run { target *-*-interix* *-*-mingw* *-*-cygwin* i?86-*-* x86_64-*-* } } */
+
+extern void abort();
+
+struct s1_t {
+ char a;
+ char b __attribute__ ((aligned (16)));
+} __attribute__ ((ms_struct));
+struct s1_t s1;
+
+struct s2_t {
+ char a;
+ char b;
+} __attribute__ ((ms_struct));
+struct s2_t s2;
+
+struct s3_t {
+ __extension__ char a : 6;
+ char b __attribute__ ((aligned (16)));
+} __attribute__ ((ms_struct));
+struct s3_t s3;
+
+struct s4_t {
+ __extension__ char a : 6;
+ char b __attribute__ ((aligned (2)));
+} __attribute__ ((ms_struct));
+struct s4_t s4;
+
+struct s5_t {
+ __extension__ char a : 6;
+ char b __attribute__ ((aligned (1)));
+} __attribute__ ((ms_struct));
+struct s5_t s5;
+
+__extension__
+static __PTRDIFF_TYPE__ offs (const void *a, const void *b)
+{
+ return (__PTRDIFF_TYPE__) ((const char*)a - (const char*)b);
+}
+
+int main()
+{
+ if (offs (&s1.b, &s1) != 16
+ || offs (&s2.b, &s2) != 1
+ || offs (&s3.b, &s3) != 16
+ || offs (&s4.b, &s4) != 2
+ || offs (&s5.b, &s5) != 1)
+ abort ();
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.dg/di-sync-multithread.c b/gcc/testsuite/gcc.dg/di-sync-multithread.c
index 307ebf8b314..c786ff1df5f 100644
--- a/gcc/testsuite/gcc.dg/di-sync-multithread.c
+++ b/gcc/testsuite/gcc.dg/di-sync-multithread.c
@@ -10,6 +10,9 @@
#include <pthread.h>
#include <unistd.h>
+#ifdef _WIN32
+#include <windows.h>
+#endif
/*#define DEBUGIT 1 */
@@ -175,7 +178,11 @@ main ()
t, err);
};
+#ifdef _WIN32
+ Sleep (5000);
+#else
sleep (5);
+#endif
/* Stop please. */
__sync_lock_test_and_set (&doquit, 1ll);
diff --git a/gcc/testsuite/gcc.dg/format/dfp-printf-1.c b/gcc/testsuite/gcc.dg/format/dfp-printf-1.c
index e92f1610c34..4453ad192b5 100644
--- a/gcc/testsuite/gcc.dg/format/dfp-printf-1.c
+++ b/gcc/testsuite/gcc.dg/format/dfp-printf-1.c
@@ -3,7 +3,7 @@
/* { dg-do compile } */
/* { dg-require-effective-target dfp } */
/* { dg-options "-Wformat" } */
-/* { dg-skip-if "No scanf/printf dfp support" { *-*-mingw* } } */
+/* { dg-skip-if "No scanf/printf dfp support" { *-*-mingw* } { "*" } { "" } } */
extern int printf (const char *restrict, ...);
diff --git a/gcc/testsuite/gcc.dg/graphite/pr50561.c b/gcc/testsuite/gcc.dg/graphite/pr50561.c
index 70c6bbcc2a3..5fbad4a7329 100644
--- a/gcc/testsuite/gcc.dg/graphite/pr50561.c
+++ b/gcc/testsuite/gcc.dg/graphite/pr50561.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -floop-flatten -floop-strip-mine" } */
+/* { dg-options "-O2 -floop-strip-mine" } */
void f (unsigned *s)
{
diff --git a/gcc/testsuite/gcc.dg/lto/pr52097_0.c b/gcc/testsuite/gcc.dg/lto/pr52097_0.c
new file mode 100644
index 00000000000..cd4af5d1f29
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/pr52097_0.c
@@ -0,0 +1,20 @@
+/* { dg-lto-do link } */
+/* { dg-lto-options { { -O -flto -fexceptions -fnon-call-exceptions --param allow-store-data-races=0 } } } */
+
+typedef struct { unsigned int e0 : 16; } s1;
+typedef struct { unsigned int e0 : 16; } s2;
+typedef struct { s1 i1; s2 i2; } io;
+
+static io *i;
+
+void f1 (void)
+{
+ s1 x0;
+ i->i1 = x0;
+}
+
+int main ()
+{
+ f1 ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/lto/trans-mem-1_0.c b/gcc/testsuite/gcc.dg/lto/trans-mem-1_0.c
deleted file mode 100644
index 379f4ea84da..00000000000
--- a/gcc/testsuite/gcc.dg/lto/trans-mem-1_0.c
+++ /dev/null
@@ -1,14 +0,0 @@
-/* { dg-lto-options {{-flto -fgnu-tm}} } */
-/* { dg-lto-do link } */
-/* { dg-require-effective-target stdint_types } */
-/* { dg-require-effective-target fgnu_tm } */
-
-int i;
-
-main()
-{
- __transaction_atomic
- {
- i = 0;
- }
-}
diff --git a/gcc/testsuite/gcc.dg/lto/trans-mem-1_1.c b/gcc/testsuite/gcc.dg/lto/trans-mem-1_1.c
deleted file mode 100644
index f49a2626e58..00000000000
--- a/gcc/testsuite/gcc.dg/lto/trans-mem-1_1.c
+++ /dev/null
@@ -1 +0,0 @@
-#include "trans-mem.h"
diff --git a/gcc/testsuite/gcc.dg/lto/trans-mem-2_0.c b/gcc/testsuite/gcc.dg/lto/trans-mem-2_0.c
deleted file mode 100644
index f86d4442685..00000000000
--- a/gcc/testsuite/gcc.dg/lto/trans-mem-2_0.c
+++ /dev/null
@@ -1,16 +0,0 @@
-/* { dg-lto-options {{-flto -fgnu-tm}} } */
-/* { dg-lto-do link } */
-/* { dg-require-effective-target stdint_types } */
-/* { dg-require-effective-target fgnu_tm } */
-
-#include "trans-mem.h"
-
-extern void foobar() __attribute__((transaction_callable));
-
-main()
-{
- __transaction_relaxed
- {
- foobar();
- }
-}
diff --git a/gcc/testsuite/gcc.dg/lto/trans-mem-2_1.c b/gcc/testsuite/gcc.dg/lto/trans-mem-2_1.c
deleted file mode 100644
index fb6918d6584..00000000000
--- a/gcc/testsuite/gcc.dg/lto/trans-mem-2_1.c
+++ /dev/null
@@ -1,4 +0,0 @@
-__attribute__((transaction_callable,noinline))
-void foobar()
-{
-}
diff --git a/gcc/testsuite/gcc.dg/lto/trans-mem-4_0.c b/gcc/testsuite/gcc.dg/lto/trans-mem-4_0.c
deleted file mode 100644
index e3f471f23c3..00000000000
--- a/gcc/testsuite/gcc.dg/lto/trans-mem-4_0.c
+++ /dev/null
@@ -1,13 +0,0 @@
-/* { dg-lto-options {{-flto -fgnu-tm}} } */
-/* { dg-lto-do link } */
-/* { dg-require-effective-target stdint_types } */
-/* { dg-require-effective-target fgnu_tm } */
-
-extern void foo() __attribute__((transaction_safe));
-
-int main()
-{
- __transaction_atomic {
- foo();
- }
-}
diff --git a/gcc/testsuite/gcc.dg/lto/trans-mem-4_1.c b/gcc/testsuite/gcc.dg/lto/trans-mem-4_1.c
deleted file mode 100644
index 620ce16b8c8..00000000000
--- a/gcc/testsuite/gcc.dg/lto/trans-mem-4_1.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include "trans-mem.h"
-
-__attribute__((transaction_safe))
-void foo()
-{
-}
diff --git a/gcc/testsuite/gcc.dg/noncompile/pr52290.c b/gcc/testsuite/gcc.dg/noncompile/pr52290.c
new file mode 100644
index 00000000000..275543cfca9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/noncompile/pr52290.c
@@ -0,0 +1,3 @@
+/* { dg-error "undeclared here" "" { target *-*-* } 3 } */
+/* { dg-error "expected" "" { target *-*-* } 3 } */
+int f()[j]
diff --git a/gcc/testsuite/gcc.dg/pack-test-5.c b/gcc/testsuite/gcc.dg/pack-test-5.c
index 7645043dd84..3a52a002bd5 100644
--- a/gcc/testsuite/gcc.dg/pack-test-5.c
+++ b/gcc/testsuite/gcc.dg/pack-test-5.c
@@ -1,6 +1,7 @@
/* PR c/11446: packed on a struct takes precedence over aligned on the type
of a field. */
/* { dg-do run } */
+/* { dg-additional-options "-mno-ms-bitfields" { target *-*-mingw* } } */
extern void abort (void);
diff --git a/gcc/testsuite/gcc.dg/pr49544.c b/gcc/testsuite/gcc.dg/pr49544.c
index 9e558da2765..52f79dd7f8e 100644
--- a/gcc/testsuite/gcc.dg/pr49544.c
+++ b/gcc/testsuite/gcc.dg/pr49544.c
@@ -3,6 +3,8 @@
/* { dg-options "-g -O2" } */
/* { dg-require-effective-target ptr32plus } */
+__extension__ typedef __PTRDIFF_TYPE__ ptr_t;
+
int baz (int, int, void *);
static inline __attribute__ ((always_inline)) long
@@ -16,5 +18,5 @@ foo (int x, int y, void *z)
long
bar (long x, long y, long z)
{
- return foo (x, y, (void *) z);
+ return foo (x, y, (void *) (ptr_t) z);
}
diff --git a/gcc/testsuite/gcc.dg/pr50251.c b/gcc/testsuite/gcc.dg/pr50251.c
index 21ca185250b..f791aa88278 100644
--- a/gcc/testsuite/gcc.dg/pr50251.c
+++ b/gcc/testsuite/gcc.dg/pr50251.c
@@ -1,4 +1,4 @@
-/* { dg-do compile } */
+/* { dg-do compile { target { ! { x86_64-*-mingw* } } } } */
/* { dg-options "-O2" } */
/* { dg-additional-options "-mpreferred-stack-boundary=12" { target x86_64-*-* } } */
diff --git a/gcc/testsuite/gcc.dg/pr51721.c b/gcc/testsuite/gcc.dg/pr51721.c
new file mode 100644
index 00000000000..b39adfb50c2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr51721.c
@@ -0,0 +1,31 @@
+/* PR tree-optimization/51721 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -Warray-bounds" } */
+
+static int a[10], b[10], c[10], d[10];
+
+unsigned int
+f (unsigned int v)
+{
+ return v == 17 ? 11 : v;
+}
+
+unsigned int
+g (unsigned int v)
+{
+ return v == 17 ? 17 : v;
+}
+
+void
+t (unsigned int s)
+{
+ if (s >> 1 == 0)
+ {
+ a[f (s)] = 0; /* { dg-bogus "array subscript is above array bounds" } */
+ a[f (s)] = 0; /* { dg-bogus "array subscript is above array bounds" } */
+ b[f (s)] = 0; /* { dg-bogus "array subscript is above array bounds" } */
+ c[g (s)] = 0; /* { dg-bogus "array subscript is above array bounds" } */
+ c[g (s)] = 0; /* { dg-bogus "array subscript is above array bounds" } */
+ d[f (s)] = 0; /* { dg-bogus "array subscript is above array bounds" } */
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/pr52132.c b/gcc/testsuite/gcc.dg/pr52132.c
index 8374994424a..ed1eb1becd2 100644
--- a/gcc/testsuite/gcc.dg/pr52132.c
+++ b/gcc/testsuite/gcc.dg/pr52132.c
@@ -2,6 +2,11 @@
/* { dg-do compile } */
/* { dg-options "-std=c99 -O2 -g" } */
+#if (__SIZEOF_INT__ < __SIZEOF_FLOAT__) \
+ && (__SIZEOF_LONG__ == __SIZEOF_FLOAT__)
+#define int long
+#endif
+
int l;
void bar (void);
@@ -10,7 +15,11 @@ foo (int *x, float y)
{
float b;
union { float f; int i; } u = { .f = y };
+#if (__SIZEOF_INT__ < __SIZEOF_FLOAT__)
+ u.i += 127L << 23;
+#else
u.i += 127 << 23;
+#endif
u.f = ((-1.0f / 3) * u.f + 2) * u.f - 2.0f / 3;
b = 0.5 * (u.f + l);
if (b >= *x)
diff --git a/gcc/testsuite/gcc.dg/pr52318.c b/gcc/testsuite/gcc.dg/pr52318.c
new file mode 100644
index 00000000000..4f367aa1cd4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr52318.c
@@ -0,0 +1,17 @@
+/* PR tree-optimization/52318 */
+/* { dg-do compile } */
+/* { dg-options "-O3 -ftracer -fno-tree-ccp -fno-tree-copy-prop -fno-tree-dce" } */
+
+int c;
+char *p;
+
+void
+foo (int i)
+{
+ char a[2];
+ char b[20];
+ p = __builtin___stpcpy_chk (a, "", 2);
+ p = __builtin___stpcpy_chk (&b[16], i ? "e" : "jkl", 4);
+ if (c)
+ foo (i);
+}
diff --git a/gcc/testsuite/gcc.dg/pr52355.c b/gcc/testsuite/gcc.dg/pr52355.c
new file mode 100644
index 00000000000..0a0271f5dff
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr52355.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+
+void f(char a[16][16][16])
+{
+ __asm volatile ("" : : "i" (&a[1][0][0] - &a[0][0][0]));
+}
+
+int main(void)
+{
+ char a[16][16][16];
+ f(a);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/pr52445.c b/gcc/testsuite/gcc.dg/pr52445.c
new file mode 100644
index 00000000000..0977821a829
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr52445.c
@@ -0,0 +1,15 @@
+/* PR tree-optimization/52445 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -ftree-cselim -fdump-tree-cselim" } */
+
+void
+foo (char *buf, unsigned long len)
+{
+ buf[0] = '\n';
+ if (len > 1)
+ buf[1] = '\0'; /* We can't cselim "optimize" this, while
+ buf[0] doesn't trap, buf[1] could. */
+}
+
+/* { dg-final { scan-tree-dump-not "cstore\." "cselim" } } */
+/* { dg-final { cleanup-tree-dump "cselim" } } */
diff --git a/gcc/testsuite/gcc.dg/simulate-thread/atomic-load-int128.c b/gcc/testsuite/gcc.dg/simulate-thread/atomic-load-int128.c
index c5aa623e685..651e76a95a5 100644
--- a/gcc/testsuite/gcc.dg/simulate-thread/atomic-load-int128.c
+++ b/gcc/testsuite/gcc.dg/simulate-thread/atomic-load-int128.c
@@ -105,9 +105,6 @@ void simulate_thread_main()
{
int x;
- /* Make sure value starts with an atomic value now. */
- __atomic_store_n (&value, ret, __ATOMIC_SEQ_CST);
-
/* Execute loads with value changing at various cyclic values. */
for (table_cycle_size = 16; table_cycle_size > 4 ; table_cycle_size--)
{
@@ -126,6 +123,10 @@ void simulate_thread_main()
main()
{
fill_table ();
+
+ /* Make sure value starts with an atomic value from the table. */
+ __atomic_store_n (&value, table[0], __ATOMIC_SEQ_CST);
+
simulate_thread_main ();
simulate_thread_done ();
return 0;
diff --git a/gcc/testsuite/gcc.dg/simulate-thread/simulate-thread.gdb b/gcc/testsuite/gcc.dg/simulate-thread/simulate-thread.gdb
index cbb65dbceeb..93f60c345cf 100644
--- a/gcc/testsuite/gcc.dg/simulate-thread/simulate-thread.gdb
+++ b/gcc/testsuite/gcc.dg/simulate-thread/simulate-thread.gdb
@@ -5,7 +5,7 @@ run
set $ret = 0
while (simulate_thread_fini != 1) && (! $ret)
- call simulate_thread_wrapper_other_threads()
+ set $ret |= simulate_thread_wrapper_other_threads()
stepi
set $ret |= simulate_thread_step_verify()
end
diff --git a/gcc/testsuite/gcc.dg/simulate-thread/simulate-thread.h b/gcc/testsuite/gcc.dg/simulate-thread/simulate-thread.h
index 9e2361faa06..22c05084ee7 100644
--- a/gcc/testsuite/gcc.dg/simulate-thread/simulate-thread.h
+++ b/gcc/testsuite/gcc.dg/simulate-thread/simulate-thread.h
@@ -37,7 +37,7 @@ simulate_thread_done ()
infinite loop to be avoided.
If the testcase defines HOSTILE_PAUSE_ERROR, then it will be
- considered an RUNTIME FAILURE if the hostile pause is triggered.
+ considered a RUNTIME FAILURE if the hostile pause is triggered.
This will allow to test for guaranteed forward progress routines.
If the default values for HOSTILE_THREAD_THRESHOLD or
@@ -50,17 +50,29 @@ simulate_thread_done ()
hostile condition is interferring. */
-/* Define the threshold to start pausing the hostile thread. */
+/* Define the threshold instruction count to start pausing the hostile
+ thread. To avoid huge potential log files when things are not going well,
+ set this number very low. If a test specifically requires that the forward
+ progress guarantee is made, this number should be raised by the testcase. */
#if !defined (HOSTILE_THREAD_THRESHOLD)
-#define HOSTILE_THREAD_THRESHOLD 500
+#define HOSTILE_THREAD_THRESHOLD 50
#endif
/* Define the length of pause in cycles for the hostile thread to pause to
- allow forward progress to be made. */
+ allow forward progress to be made. If this number is too low, a
+ compare_and_swap loop may not have time to finish, especially on a
+ 128 bit operation. */
#if !defined (HOSTILE_THREAD_PAUSE)
#define HOSTILE_THREAD_PAUSE 20
#endif
+/* Define the number of instructions which are allowed to be executed before
+ the testcase is deemed to fail. This is primarily to avoid huge log files
+ when a testcase goes into an infinte loop. */
+#if !defined (INSN_COUNT_THRESHOLD)
+#define INSN_COUNT_THRESHOLD 10000
+#endif
+
void simulate_thread_other_threads (void);
int simulate_thread_final_verify (void);
@@ -71,26 +83,34 @@ static int simulate_thread_hostile_pause = 0;
is reached, the other_thread process is paused for
HOSTILE_THREAD_PAUSE cycles before resuming, and the counters start
again. */
-void
+int
simulate_thread_wrapper_other_threads()
{
- static int count = 0;
- static int pause = 0;
+ static int insn_count = 0;
+ static int hostile_count = 0;
+ static int hostile_pause = 0;
+
+ if (++insn_count >= INSN_COUNT_THRESHOLD)
+ {
+ printf ("FAIL: Testcase exceeded maximum instruction count threshold\n");
+ return 1;
+ }
- if (++count >= HOSTILE_THREAD_THRESHOLD)
+ if (++hostile_count >= HOSTILE_THREAD_THRESHOLD)
{
if (!simulate_thread_hostile_pause)
simulate_thread_hostile_pause = 1;
/* Count cycles before calling the hostile thread again. */
- if (pause++ < HOSTILE_THREAD_PAUSE)
- return;
+ if (hostile_pause++ < HOSTILE_THREAD_PAUSE)
+ return 0;
/* Reset the pause counter, as well as the thread counter. */
- pause = 0;
- count = 0;
+ hostile_pause = 0;
+ hostile_count = 0;
}
simulate_thread_other_threads ();
+ return 0;
}
diff --git a/gcc/testsuite/gcc.dg/simulate-thread/speculative-store.c b/gcc/testsuite/gcc.dg/simulate-thread/speculative-store.c
index 71d1cca9dda..ff9d71e0875 100644
--- a/gcc/testsuite/gcc.dg/simulate-thread/speculative-store.c
+++ b/gcc/testsuite/gcc.dg/simulate-thread/speculative-store.c
@@ -24,6 +24,7 @@ int simulate_thread_step_verify()
printf("FAIL: global variable was assigned to. \n");
return 1;
}
+ return 0;
}
int simulate_thread_final_verify()
diff --git a/gcc/testsuite/gcc.dg/stack-usage-1.c b/gcc/testsuite/gcc.dg/stack-usage-1.c
index 77dd03852fb..c852f78f5cd 100644
--- a/gcc/testsuite/gcc.dg/stack-usage-1.c
+++ b/gcc/testsuite/gcc.dg/stack-usage-1.c
@@ -10,7 +10,11 @@
#if defined(__i386__)
# define SIZE 248
#elif defined(__x86_64__)
-# define SIZE 356
+# ifndef _WIN64
+# define SIZE 356
+# else
+# define SIZE (256 - 24)
+# endif
#elif defined (__sparc__)
# if defined (__arch64__)
# define SIZE 76
diff --git a/gcc/testsuite/gcc.dg/tls/opt-11.c b/gcc/testsuite/gcc.dg/tls/opt-11.c
index 0069c484a2c..edfe16b7e12 100644
--- a/gcc/testsuite/gcc.dg/tls/opt-11.c
+++ b/gcc/testsuite/gcc.dg/tls/opt-11.c
@@ -2,8 +2,10 @@
/* { dg-require-effective-target tls_runtime } */
/* { dg-add-options tls } */
+__extension__ typedef __SIZE_TYPE__ size_t;
+
extern void abort (void);
-extern void *memset (void *, int, __SIZE_TYPE__);
+extern void *memset (void *, int, size_t);
struct A
{
diff --git a/gcc/testsuite/gcc.dg/tls/thr-cse-1.c b/gcc/testsuite/gcc.dg/tls/thr-cse-1.c
index 87fdc64688d..8e64424b72a 100644
--- a/gcc/testsuite/gcc.dg/tls/thr-cse-1.c
+++ b/gcc/testsuite/gcc.dg/tls/thr-cse-1.c
@@ -18,10 +18,11 @@ int foo (int b, int c, int d)
return a;
}
-/* { dg-final { scan-assembler-not "emutls_get_address.*emutls_get_address.*" { target { ! { "*-wrs-vxworks" "*-*-darwin8" "hppa*-*-hpux*" "spu-*-*" "i?86-*-mingw*" } } } } } */
+/* { dg-final { scan-assembler-not "emutls_get_address.*emutls_get_address.*" { target { ! { "*-wrs-vxworks" "*-*-darwin8" "hppa*-*-hpux*" "spu-*-*" "i?86-*-mingw*" "x86_64-*-mingw*" } } } } } */
/* { dg-final { scan-assembler-not "call\tL___emutls_get_address.stub.*call\tL___emutls_get_address.stub.*" { target "*-*-darwin8" } } } */
/* { dg-final { scan-assembler-not "(b,l|bl) __emutls_get_address.*(b,l|bl) __emutls_get_address.*" { target "hppa*-*-hpux*" } } } */
/* { dg-final { scan-assembler-not "(brsl|brasl)\t__emutls_get_address.*(brsl|brasl)\t__emutls_get_address.*" { target spu-*-* } } } */
/* { dg-final { scan-assembler-not "tls_lookup.*tls_lookup.*" { target *-wrs-vxworks } } } */
/* { dg-final { scan-assembler-not "call\t___emutls_get_address.*call\t___emutls_get_address" { target "i?86-*-mingw*" } } } */
+/* { dg-final { scan-assembler-not "call\t__emutls_get_address.*call\t__emutls_get_address" { target "x86_64-*-mingw*" } } } */
diff --git a/gcc/testsuite/gcc.dg/tm/pr52141.c b/gcc/testsuite/gcc.dg/tm/pr52141.c
new file mode 100644
index 00000000000..0dabf76ce6d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tm/pr52141.c
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -O0 -w" } */
+
+__attribute__((always_inline))
+static void asmfunc(void)
+{
+ __asm__ (""); /* { dg-error "asm not allowed in .transaction_safe" } */
+}
+
+__attribute__((transaction_safe))
+static void f(void)
+{
+ asmfunc();
+}
+
+int main()
+{
+ __transaction_atomic {
+ f();
+ }
+ return 0;
+}
+
+/* { dg-message "inlined from \'f\'" "" { target *-*-* } 0 } */
diff --git a/gcc/testsuite/gcc.dg/tm/pub-safety-1.c b/gcc/testsuite/gcc.dg/tm/pub-safety-1.c
new file mode 100644
index 00000000000..660e9a62767
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tm/pub-safety-1.c
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm -O1 -fdump-tree-lim1" } */
+
+/* Test that thread visible loads do not get hoisted out of loops if
+ the load would not have occurred on each path out of the loop. */
+
+int x[10] = {0,0,0,0,0,0,0,0,0,0};
+int DATA_DATA = 0;
+
+void reader()
+{
+ int i;
+ __transaction_atomic
+ {
+ for (i = 0; i < 10; i++)
+ if (x[i])
+ x[i] += DATA_DATA;
+ /* If we loaded DATA_DATA here, we could hoist it before the loop,
+ but since we don't... we can't. */
+ }
+}
+
+/* { dg-final { scan-tree-dump-times "Cannot hoist.*DATA_DATA because it is in a transaction" 1 "lim1" } } */
+/* { dg-final { cleanup-tree-dump "lim1" } } */
diff --git a/gcc/testsuite/gcc.dg/torture/builtin-complex-1.c b/gcc/testsuite/gcc.dg/torture/builtin-complex-1.c
index 0c2f98b832a..20dc4c48a28 100644
--- a/gcc/testsuite/gcc.dg/torture/builtin-complex-1.c
+++ b/gcc/testsuite/gcc.dg/torture/builtin-complex-1.c
@@ -18,11 +18,13 @@ extern void abort (void);
abort (); \
} while (0)
+#ifndef __SPU__
void
comparef (float a, float b)
{
COMPARE_BODY (a, b, float, __builtin_copysignf);
}
+#endif
void
compare (double a, double b)
@@ -36,12 +38,14 @@ comparel (long double a, long double b)
COMPARE_BODY (a, b, long double, __builtin_copysignl);
}
+#ifndef __SPU__
void
comparecf (_Complex float a, float r, float i)
{
comparef (__real__ a, r);
comparef (__imag__ a, i);
}
+#endif
void
comparec (_Complex double a, double r, double i)
@@ -90,8 +94,10 @@ comparecl (_Complex long double a, long double r, long double i)
void
check_float (void)
{
+#ifndef __SPU__
ALL_CHECKS (0.0f, -0.0f, __builtin_nanf(""), __builtin_inff(),
float, comparecf);
+#endif
}
void
diff --git a/gcc/testsuite/gcc.dg/torture/pr47917.c b/gcc/testsuite/gcc.dg/torture/pr47917.c
index 831305d601a..d3649fb7409 100644
--- a/gcc/testsuite/gcc.dg/torture/pr47917.c
+++ b/gcc/testsuite/gcc.dg/torture/pr47917.c
@@ -3,6 +3,7 @@
/* { dg-options "-std=c99 -D_ISO_C_SOURCE=19990L" { target alpha*-dec-osf5* } } */
/* { dg-options "-std=c99 -D_XOPEN_SOURCE=500" { target mips-sgi-irix6.5 *-*-solaris2.[89] } } */
/* { dg-options "-std=gnu99" { target *-*-hpux* } } */
+/* { dg-additional-options "-D__USE_MINGW_ANSI_STDIO=1" { target *-*-mingw* } } */
/* { dg-xfail-if "no C99 snprintf function" { *-*-hpux10* } } */
/* { dg-xfail-run-if "non-conforming C99 snprintf" { *-*-hpux11.[012]* } } */
diff --git a/gcc/testsuite/gcc.dg/torture/pr52298.c b/gcc/testsuite/gcc.dg/torture/pr52298.c
new file mode 100644
index 00000000000..f0799c1a5c8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr52298.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+
+int a, b, c, h;
+
+int i[5][5];
+
+void
+fn1 ()
+{
+ int l = 0;
+
+ for (a = 0; a <= 3; a++)
+ for (b = 1; b >= 0; b -= 1)
+ l |= i[0][b];
+ c = l;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr52402.c b/gcc/testsuite/gcc.dg/torture/pr52402.c
new file mode 100644
index 00000000000..ba7c5ae24c5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr52402.c
@@ -0,0 +1,30 @@
+/* { dg-do run } */
+/* { dg-options "-w -Wno-psabi" } */
+/* { dg-require-effective-target int32plus } */
+
+typedef int v4si __attribute__((vector_size(16)));
+struct T { v4si i[2]; int j; } __attribute__((packed));
+
+static v4si __attribute__((noinline))
+foo (struct T t)
+{
+ return t.i[0];
+}
+
+static struct T *__attribute__((noinline))
+init ()
+{
+ char *p = __builtin_malloc (sizeof (struct T) + 1);
+ p++;
+ __builtin_memset (p, 1, sizeof (struct T));
+ return (struct T *)p;
+}
+
+int main()
+{
+ struct T *p;
+ p = init ();
+ if (foo (*p)[0] != 0x01010101)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr52406.c b/gcc/testsuite/gcc.dg/torture/pr52406.c
new file mode 100644
index 00000000000..5579d0943ae
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr52406.c
@@ -0,0 +1,29 @@
+/* { dg-do run } */
+
+extern void abort (void);
+struct { int f1; } a[2];
+
+int *b, *const k = &a[1].f1;
+static int **c = &b;
+
+int e, f, d;
+
+int
+main ()
+{
+ int **l = &b;
+ *l = k;
+ for (; d <= 0; d++)
+ {
+ int *j = &e;
+ **c = 1;
+ *l = k;
+ *k ^= 0;
+ f = **l;
+ *j = f;
+ }
+ if (e != 1)
+ abort ();
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.dg/torture/pr52407.c b/gcc/testsuite/gcc.dg/torture/pr52407.c
new file mode 100644
index 00000000000..bb95e51f25b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr52407.c
@@ -0,0 +1,33 @@
+/* { dg-do run } */
+
+extern void abort (void);
+
+typedef long long T;
+typedef T vl_t __attribute__((vector_size(2 * sizeof (T))));
+
+vl_t ul[4], vl[4] = { { 1, 2 }, { 3, 4 }, { 5, 6 }, { 7, 8 } };
+
+static void
+mul_vl_l(vl_t *u, vl_t *v, T x, int m)
+{
+ vl_t w;
+ T *p = (T *)&w;
+ p[0] = p[1] = x;
+ while (m--)
+ *u++ = *v++ * w;
+}
+
+int
+main(int argc, char *argv[])
+{
+ int i;
+ T *pl;
+
+ pl = (T *) &ul;
+ mul_vl_l(ul, vl, 2, 4);
+ for (i = 0; i < 8; i++)
+ if (pl[i] != 2 * (i + 1))
+ abort ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr52419.c b/gcc/testsuite/gcc.dg/torture/pr52419.c
new file mode 100644
index 00000000000..d24225a3ea7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr52419.c
@@ -0,0 +1,32 @@
+/* PR middle-end/52419 */
+/* { dg-do run } */
+
+extern void abort (void);
+
+typedef long long V
+ __attribute__ ((vector_size (2 * sizeof (long long)), may_alias));
+
+typedef struct S { V b; } P __attribute__((aligned (1)));
+
+struct __attribute__((packed)) T { char c; P s; };
+
+__attribute__((noinline, noclone)) void
+foo (P *p)
+{
+ p->b[1] = 5;
+}
+
+int
+main ()
+{
+ V a = { 3, 4 };
+ struct T t;
+
+ t.s.b = a;
+ foo (&t.s);
+
+ if (t.s.b[0] != 3 || t.s.b[1] != 5)
+ abort ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr52429.c b/gcc/testsuite/gcc.dg/torture/pr52429.c
new file mode 100644
index 00000000000..e2aeaa9714d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr52429.c
@@ -0,0 +1,24 @@
+/* PR tree-optimization/52429 */
+/* { dg-do compile } */
+/* { dg-require-effective-target pthread } */
+/* { dg-options "-g -ftree-parallelize-loops=4" } */
+
+double d[65536], e[65536];
+
+void
+foo (void)
+{
+ int i;
+ double f, g;
+ for (i = 0; i < 65536; i++)
+ {
+ f = e[i];
+ goto lab1;
+ lab2:
+ d[i] = f * g;
+ continue;
+ lab1:
+ g = d[i];
+ goto lab2;
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr52493.c b/gcc/testsuite/gcc.dg/torture/pr52493.c
new file mode 100644
index 00000000000..b04ac5c17db
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr52493.c
@@ -0,0 +1,38 @@
+/* { dg-do compile } */
+
+struct Time {
+ long int sec;
+ long usec;
+};
+struct Flow {
+ unsigned short iif;
+ struct Time mtime;
+};
+struct NetFlow {
+ unsigned MaxFlows;
+ unsigned HeaderFields;
+ unsigned short *HeaderFormat;
+};
+static struct NetFlow *netflow;
+static struct Time start_time;
+static unsigned char emit_packet[1500];
+inline long int cmpmtime(struct Time *t1, struct Time *t2)
+{
+ return (t1->sec - t2->sec) * 1000 + (t1->usec - t2->usec) / 1000;
+}
+static void fill(int fields, unsigned short *format,
+ struct Flow *flow, void *p)
+{
+ int i;
+ for (i = 0; i < fields; i++)
+ if (format[i] == 21)
+ {
+ unsigned int __v;
+ __v = cmpmtime(&flow->mtime, &start_time);
+ *((unsigned int *) p) = __v;
+ }
+}
+void emit_thread()
+{
+ fill(netflow->HeaderFields, netflow->HeaderFormat, 0, &emit_packet);
+}
diff --git a/gcc/testsuite/gcc.dg/torture/va-arg-25.c b/gcc/testsuite/gcc.dg/torture/va-arg-25.c
index 8c0da549d08..64aaffac8b7 100644
--- a/gcc/testsuite/gcc.dg/torture/va-arg-25.c
+++ b/gcc/testsuite/gcc.dg/torture/va-arg-25.c
@@ -4,7 +4,7 @@
/* { dg-options "-msse" { target { i?86-*-* x86_64-*-* } } } */
/* { dg-require-effective-target sse_runtime { target { i?86-*-* x86_64-*-* } } } */
/* { dg-options "-mabi=altivec -maltivec" { target { powerpc-*-* powerpc64-*-* } } } */
-/* { dg-require-effective-target vmx_hw { target { powerpc-*-* powerpc64--*-* } } } */
+/* { dg-require-effective-target vmx_hw { target { powerpc-*-* powerpc64-*-* } } } */
#include <stdarg.h>
#include <stdlib.h>
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ipa-split-6.c b/gcc/testsuite/gcc.dg/tree-ssa/ipa-split-6.c
new file mode 100644
index 00000000000..12070fa3362
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ipa-split-6.c
@@ -0,0 +1,10 @@
+/* PR tree-optimization/52019 */
+/* { dg-do compile } */
+/* { dg-options "-O3 -fno-tree-sra -fdump-tree-fnsplit -fdump-tree-optimized" } */
+
+#include "ipa-split-5.c"
+
+/* { dg-final { scan-tree-dump-times "Splitting function" 1 "fnsplit"} } */
+/* { dg-final { cleanup-tree-dump "fnsplit" } } */
+/* { dg-final { scan-tree-dump "part" "optimized"} } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-8.c b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-8.c
new file mode 100644
index 00000000000..31dab46a795
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-8.c
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fdump-tree-optimized -fdump-tree-phiopt1" } */
+
+int g(int,int);
+int f(int t, int c)
+{
+ int d = 0;
+ int e = 0;
+ if (t)
+ {
+ d = 1;
+ e = t;
+ }
+ else d = 0, e = 0;
+ return g(e,d);
+}
+
+/* This testcase should be reduced to e = t; d = t != 0; in phiopt1
+ but currently is not as PHI-OPT does not reduce the t PHI as we have
+ two phis. Note this is fixed with
+ http://gcc.gnu.org/ml/gcc-patches/2012-01/msg01195.html . */
+/* { dg-final { scan-tree-dump-not "if" "phiopt1" { xfail *-*-* } } } */
+/* { dg-final { scan-tree-dump "g .t_\[0-9\]*.D.," "optimized" } } */
+/* { dg-final { scan-tree-dump-not "PHI" "optimized" } } */
+/* { dg-final { cleanup-tree-dump "phiopt1" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-9.c b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-9.c
new file mode 100644
index 00000000000..dccea7b0506
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-9.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fdump-tree-optimized" } */
+
+int g(int,int);
+int f(int t, int c)
+{
+ int d = 0;
+ int e = 0;
+ if (t)
+ {
+ d = c+1;
+ e = t;
+ }
+ else d = 0, e = 0;
+ return g(e,d);
+}
+
+/* The value e should have been replaced with t and there should be only one PHI. */
+/* { dg-final { scan-tree-dump "g .t_\[0-9\]*.D.," "optimized" } } */
+/* { dg-final { scan-tree-dump-times "PHI" 1 "optimized" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/scev-3.c b/gcc/testsuite/gcc.dg/tree-ssa/scev-3.c
new file mode 100644
index 00000000000..28d5c932727
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/scev-3.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+int *a_p;
+int a[1000];
+
+f(int k)
+{
+ int i;
+
+ for (i=k; i<1000; i+=k) {
+ a_p = &a[i];
+ *a_p = 100;
+ }
+}
+
+/* { dg-final { scan-tree-dump-times "&a" 1 "optimized" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/scev-4.c b/gcc/testsuite/gcc.dg/tree-ssa/scev-4.c
new file mode 100644
index 00000000000..6c1e530a92f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/scev-4.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-optimized" } */
+
+typedef struct {
+ int x;
+ int y;
+} S;
+
+int *a_p;
+S a[1000];
+
+f(int k)
+{
+ int i;
+
+ for (i=k; i<1000; i+=k) {
+ a_p = &a[i].y;
+ *a_p = 100;
+ }
+}
+
+/* { dg-final { scan-tree-dump-times "&a" 1 "optimized" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-10.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-10.c
new file mode 100644
index 00000000000..bc149265dd7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-lim-10.c
@@ -0,0 +1,31 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-lim1-details" } */
+
+int *l, *r;
+int test_func(void)
+{
+ int i;
+ int direction;
+ static int pos;
+
+ pos = 0;
+ direction = 1;
+
+ for ( i = 0; i <= 400; i++ )
+ {
+ if ( direction == 0 )
+ pos = l[pos];
+ else
+ pos = r[pos];
+
+ if ( pos == -1 )
+ {
+ pos = 0;
+ direction = !direction;
+ }
+ }
+ return i;
+}
+
+/* { dg-final { scan-tree-dump "Executing store motion of pos" "lim1" } } */
+/* { dg-final { cleanup-tree-dump "lim1" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp63.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp63.c
new file mode 100644
index 00000000000..9116847de53
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp63.c
@@ -0,0 +1,345 @@
+/* PR tree-optimization/51721 */
+/* { dg-do link } */
+/* { dg-options "-O2" } */
+
+extern void link_error (void);
+
+#define BITSM1 (sizeof (int) * __CHAR_BIT__ - 1)
+
+void
+f1 (unsigned int s)
+{
+ if (s >> 1 == 0)
+ {
+ if (s == 2 || s == -1U)
+ link_error ();
+ }
+ else
+ {
+ if (s == 0 || s == 1)
+ link_error ();
+ }
+}
+
+void
+f2 (unsigned int s)
+{
+ if (s >> 4 != 3)
+ {
+ if (s == 48 || s == 57 || s == 63)
+ link_error ();
+ }
+ else
+ {
+ if (s == 47 || s == 64 || s == 0 || s == -1U)
+ link_error ();
+ }
+}
+
+void
+f3 (int s)
+{
+ if (s >> 3 == -2)
+ {
+ if (s == -17 || s == -8 || s == 0
+ || s == -__INT_MAX__ - 1 || s == __INT_MAX__)
+ link_error ();
+ }
+ else
+ {
+ if (s == -16 || s == -12 || s == -9)
+ link_error ();
+ }
+}
+
+void
+f4 (unsigned int s)
+{
+ if (s >> 2 < 4)
+ {
+ if (s == 16 || s == 20 || s == -1U)
+ link_error ();
+ }
+ else
+ {
+ if (s == 0 || s == 2 || s == 14 || s == 15)
+ link_error ();
+ }
+}
+
+void
+f5 (unsigned int s)
+{
+ if (s >> 3 <= 7)
+ {
+ if (s == 64 || s == 68 || s == -1U)
+ link_error ();
+ }
+ else
+ {
+ if (s == 0 || s == 1 || s == 62 || s == 63)
+ link_error ();
+ }
+}
+
+void
+f6 (unsigned int s)
+{
+ if (s >> 1 > 2)
+ {
+ if (s == 0 || s == 3 || s == 5)
+ link_error ();
+ }
+ else
+ {
+ if (s == 6 || s == 8 || s == -1U)
+ link_error ();
+ }
+}
+
+void
+f7 (unsigned int s)
+{
+ if (s >> 5 >= 7)
+ {
+ if (s == 0 || s == 2 || s == 221 || s == 223)
+ link_error ();
+ }
+ else
+ {
+ if (s == 224 || s == 256 || s == 258 || s == -1U)
+ link_error ();
+ }
+}
+
+void
+f8 (int s)
+{
+ if (s >> 2 < -3)
+ {
+ if (s == -12 || s == -10 || s == 0 || s == __INT_MAX__)
+ link_error ();
+ }
+ else
+ {
+ if (s == -13 || s == -16 || s == -__INT_MAX__ - 1)
+ link_error ();
+ }
+}
+
+void
+f9 (int s)
+{
+ if (s >> 3 <= -2)
+ {
+ if (s == -8 || s == -6 || s == 0 || s == __INT_MAX__)
+ link_error ();
+ }
+ else
+ {
+ if (s == -9 || s == -11 || s == -__INT_MAX__ - 1)
+ link_error ();
+ }
+}
+
+void
+f10 (int s)
+{
+ if (s >> 1 > -4)
+ {
+ if (s == -7 || s == -9 || s == -__INT_MAX__ - 1)
+ link_error ();
+ }
+ else
+ {
+ if (s == -6 || s == -4 || s == 0 || s == __INT_MAX__)
+ link_error ();
+ }
+}
+
+void
+f11 (int s)
+{
+ if (s >> 3 >= -6)
+ {
+ if (s == -49 || s == -51 || s == -__INT_MAX__ - 1)
+ link_error ();
+ }
+ else
+ {
+ if (s == -48 || s == -46 || s == 0 || s == __INT_MAX__)
+ link_error ();
+ }
+}
+
+void
+f12 (int s)
+{
+ if (s >> 2 < 4)
+ {
+ if (s == 16 || s == 20 || s == __INT_MAX__)
+ link_error ();
+ }
+ else
+ {
+ if (s == 0 || s == 2 || s == 14 || s == 15
+ || s == -2 || s == -__INT_MAX__ - 1)
+ link_error ();
+ }
+}
+
+void
+f13 (int s)
+{
+ if (s >> 3 <= 7)
+ {
+ if (s == 64 || s == 68 || s == __INT_MAX__)
+ link_error ();
+ }
+ else
+ {
+ if (s == 0 || s == 1 || s == 62 || s == 63
+ || s == -2 || s == -__INT_MAX__ - 1)
+ link_error ();
+ }
+}
+
+void
+f14 (int s)
+{
+ if (s >> 1 > 2)
+ {
+ if (s == 0 || s == 3 || s == 5
+ || s == -2 || s == -__INT_MAX__ - 1)
+ link_error ();
+ }
+ else
+ {
+ if (s == 6 || s == 8 || s == __INT_MAX__)
+ link_error ();
+ }
+}
+
+void
+f15 (int s)
+{
+ if (s >> 5 >= 7)
+ {
+ if (s == 0 || s == 2 || s == 221 || s == 223
+ || s == -2 || s == -__INT_MAX__ - 1)
+ link_error ();
+ }
+ else
+ {
+ if (s == 224 || s == 256 || s == 258 || s == __INT_MAX__)
+ link_error ();
+ }
+}
+
+unsigned int
+f16 (unsigned int s)
+{
+ unsigned int t = s >> BITSM1;
+ if (t != 0)
+ {
+ if (s == 0 || s == 5 || s == __INT_MAX__)
+ link_error ();
+ }
+ else
+ {
+ if (s == 1U + __INT_MAX__ || s == 6U + __INT_MAX__ || s == -1U)
+ link_error ();
+ }
+ return t;
+}
+
+int
+f17 (int s)
+{
+ int t = s >> BITSM1;
+ if (t == 0)
+ {
+ if (s == -1 || s == -5 || s == -__INT_MAX__ - 1)
+ link_error ();
+ }
+ else
+ {
+ if (s == 0 || s == 5 || s == __INT_MAX__)
+ link_error ();
+ }
+ return t;
+}
+
+unsigned int
+f18 (unsigned int s)
+{
+ unsigned int t = s >> BITSM1;
+ if (t >= 1)
+ {
+ if (s == 0 || s == 5 || s == __INT_MAX__)
+ link_error ();
+ }
+ else
+ {
+ if (s == 1U + __INT_MAX__ || s == 6U + __INT_MAX__ || s == -1U)
+ link_error ();
+ }
+ return t;
+}
+
+int
+f19 (int s)
+{
+ int t = s >> BITSM1;
+ if (t >= 0)
+ {
+ if (s == -1 || s == -5 || s == -__INT_MAX__ - 1)
+ link_error ();
+ }
+ else
+ {
+ if (s == 0 || s == 5 || s == __INT_MAX__)
+ link_error ();
+ }
+ return t;
+}
+
+unsigned int
+f20 (unsigned int s)
+{
+ unsigned int t = s >> BITSM1;
+ if (t < 1)
+ {
+ if (s == 1U + __INT_MAX__ || s == 6U + __INT_MAX__ || s == -1U)
+ link_error ();
+ }
+ else
+ {
+ if (s == 0 || s == 5 || s == __INT_MAX__)
+ link_error ();
+ }
+ return t;
+}
+
+int
+f21 (int s)
+{
+ int t = s >> BITSM1;
+ if (t < 0)
+ {
+ if (s == 0 || s == 5 || s == __INT_MAX__)
+ link_error ();
+ }
+ else
+ {
+ if (s == -1 || s == -5 || s == -__INT_MAX__ - 1)
+ link_error ();
+ }
+ return t;
+}
+
+int
+main ()
+{
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/vect/pr46126.c b/gcc/testsuite/gcc.dg/vect/pr46126.c
index 6eb178aab2e..c46d7f40d33 100644
--- a/gcc/testsuite/gcc.dg/vect/pr46126.c
+++ b/gcc/testsuite/gcc.dg/vect/pr46126.c
@@ -1,5 +1,7 @@
/* { dg-do compile } */
+__extension__ typedef __UINTPTR_TYPE__ uintptr_t;
+
typedef struct TypHeader {
struct TypHeader * * ptr;
unsigned char type;
@@ -11,13 +13,13 @@ typedef struct TypHeader {
TypHandle * ptApp;
long lp;
long lc;
- hdApp = ((long)(((TypHandle*)((hdCall)->ptr))[1])&1 ?
+ hdApp = ((uintptr_t)(((TypHandle*)((hdCall)->ptr))[1])&1 ?
(((TypHandle*)((hdCall)->ptr))[1]) : (*
-EvTab[(((long)(((TypHandle*)((hdCall)->ptr))[1]) & 1) ? 1 :
+EvTab[(((uintptr_t)(((TypHandle*)((hdCall)->ptr))[1]) & 1) ? 1 :
((((TypHandle*)((hdCall)->ptr))[1])->type))])((((TypHandle*)((hdCall)->ptr))[1])));
ptApp = ((TypHandle*)((hdApp)->ptr));
- ptApp[1] = ((TypHandle) (((long)(lp) << 2) + 1));
- ptApp[2] = ((TypHandle) (((long)(lc) << 2) + 1));
+ ptApp[1] = ((TypHandle) (uintptr_t) (((long)(lp) << 2) + 1));
+ ptApp[2] = ((TypHandle) (uintptr_t) (((long)(lc) << 2) + 1));
}
/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/pr52298.c b/gcc/testsuite/gcc.dg/vect/pr52298.c
new file mode 100644
index 00000000000..c2401607c45
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr52298.c
@@ -0,0 +1,31 @@
+/* { dg-do run } */
+/* { dg-options "-O1 -ftree-vectorize -fno-tree-pre -fno-tree-loop-im" } */
+
+extern void abort (void);
+int c[80];
+
+__attribute__((noinline)) int
+foo (void)
+{
+ int l = 0;
+ int a, b;
+
+ for (a = 3; a >= 0; a--)
+ for (b = 7; b >= 0; b--)
+ l |= c[a+60];
+ return l;
+}
+
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 60; i++)
+ c[i] = 1;
+ for (; i < 64; i++)
+ c[i] = 1 << (i - 59);
+ if (foo () != 30)
+ abort ();
+ return 0;
+}
+