From e97c99f15937e5762a973b25192aab824126a6d3 Mon Sep 17 00:00:00 2001 From: Rong Xu Date: Tue, 2 Sep 2014 15:29:57 -0700 Subject: [gcc-4.9] Merge svn r214745 from google/gcc-4_9 branch. Merge gcc-4_9 source r214745 from google/gcc-4_9 branch. Change-Id: Ie6fa0fd72f4b4eec3adc4db4bb922e652d1c2605 --- .../testsuite/gcc.dg/atomic/c11-atomic-exec-4.c | 2 +- .../testsuite/gcc.dg/atomic/c11-atomic-exec-5.c | 2 +- .../gcc/testsuite/gcc.dg/atomic/stdatomic-flag.c | 1 + gcc-4.9/gcc/testsuite/gcc.dg/lto/pr60449_0.c | 30 +++++++++ gcc-4.9/gcc/testsuite/gcc.dg/lto/pr60449_1.c | 76 ++++++++++++++++++++++ gcc-4.9/gcc/testsuite/gcc.dg/pr51879-18.c | 2 +- gcc-4.9/gcc/testsuite/gcc.dg/pr57233.c | 1 + gcc-4.9/gcc/testsuite/gcc.dg/pr59418.c | 2 +- gcc-4.9/gcc/testsuite/gcc.dg/pr61756.c | 14 ++++ gcc-4.9/gcc/testsuite/gcc.dg/pr61776.c | 27 ++++++++ gcc-4.9/gcc/testsuite/gcc.dg/pr62004.c | 47 +++++++++++++ gcc-4.9/gcc/testsuite/gcc.dg/pr62030.c | 50 ++++++++++++++ gcc-4.9/gcc/testsuite/gcc.dg/torture/pr61964.c | 33 ++++++++++ .../gcc/testsuite/gcc.dg/tree-ssa/ssa-copyprop-2.c | 13 ++++ gcc-4.9/gcc/testsuite/gcc.dg/vect/pr62073.c | 40 ++++++++++++ 15 files changed, 336 insertions(+), 4 deletions(-) create mode 100644 gcc-4.9/gcc/testsuite/gcc.dg/lto/pr60449_0.c create mode 100644 gcc-4.9/gcc/testsuite/gcc.dg/lto/pr60449_1.c create mode 100644 gcc-4.9/gcc/testsuite/gcc.dg/pr61756.c create mode 100644 gcc-4.9/gcc/testsuite/gcc.dg/pr61776.c create mode 100644 gcc-4.9/gcc/testsuite/gcc.dg/pr62004.c create mode 100644 gcc-4.9/gcc/testsuite/gcc.dg/pr62030.c create mode 100644 gcc-4.9/gcc/testsuite/gcc.dg/torture/pr61964.c create mode 100644 gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/ssa-copyprop-2.c create mode 100644 gcc-4.9/gcc/testsuite/gcc.dg/vect/pr62073.c (limited to 'gcc-4.9/gcc/testsuite/gcc.dg') diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/atomic/c11-atomic-exec-4.c b/gcc-4.9/gcc/testsuite/gcc.dg/atomic/c11-atomic-exec-4.c index 1558200db..b03d2c88d 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/atomic/c11-atomic-exec-4.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/atomic/c11-atomic-exec-4.c @@ -2,7 +2,7 @@ operating properly when operations on the same variable are carried out in two threads. */ /* { dg-do run } */ -/* { dg-options "-std=c11 -pedantic-errors -pthread -D_POSIX_C_SOURCE=200809L" } */ +/* { dg-options "-std=c11 -pedantic-errors -pthread -U_POSIX_C_SOURCE -D_POSIX_C_SOURCE=200809L" } */ /* { dg-additional-options "-D_XOPEN_SOURCE=600" { target *-*-solaris2.1[0-9]* } } /* { dg-require-effective-target pthread } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/atomic/c11-atomic-exec-5.c b/gcc-4.9/gcc/testsuite/gcc.dg/atomic/c11-atomic-exec-5.c index bc87de4cc..e3e0aae4d 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/atomic/c11-atomic-exec-5.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/atomic/c11-atomic-exec-5.c @@ -3,7 +3,7 @@ iterations of the compare-and-exchange loop are needed, exceptions get properly cleared). */ /* { dg-do run } */ -/* { dg-options "-std=c11 -pedantic-errors -pthread -D_POSIX_C_SOURCE=200809L" } */ +/* { dg-options "-std=c11 -pedantic-errors -pthread -U_POSIX_C_SOURCE -D_POSIX_C_SOURCE=200809L" } */ /* { dg-additional-options "-D_XOPEN_SOURCE=600" { target *-*-solaris2.1[0-9]* } } /* { dg-require-effective-target fenv_exceptions } */ /* { dg-require-effective-target pthread } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/atomic/stdatomic-flag.c b/gcc-4.9/gcc/testsuite/gcc.dg/atomic/stdatomic-flag.c index c1a63f1b3..515d5d8dd 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/atomic/stdatomic-flag.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/atomic/stdatomic-flag.c @@ -1,4 +1,5 @@ /* Test atomic_flag routines for existence and execution. */ +/* The test needs a lockless atomic implementation. */ /* { dg-do run { xfail hppa*-*-hpux* } } */ /* { dg-options "-std=c11 -pedantic-errors" } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/lto/pr60449_0.c b/gcc-4.9/gcc/testsuite/gcc.dg/lto/pr60449_0.c new file mode 100644 index 000000000..a430830cb --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/lto/pr60449_0.c @@ -0,0 +1,30 @@ +/* { dg-lto-do link } */ + +extern int printf (const char *__restrict __format, ...); +typedef long int __time_t; +typedef long int __suseconds_t; + +struct timeval + { + __time_t tv_sec; + __suseconds_t tv_usec; + }; + +struct timezone + { + int tz_minuteswest; + int tz_dsttime; + }; +typedef struct timezone *__restrict __timezone_ptr_t; + +extern int gettimeofday (struct timeval *__restrict __tv, __timezone_ptr_t __tz); + +int bar (void) +{ + struct timeval tv; + struct timezone tz; + + gettimeofday (&tv, &tz); + printf ("This is from bar %i\n", tz.tz_dsttime); + return 5; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/lto/pr60449_1.c b/gcc-4.9/gcc/testsuite/gcc.dg/lto/pr60449_1.c new file mode 100644 index 000000000..ddc25296d --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/lto/pr60449_1.c @@ -0,0 +1,76 @@ +extern int printf (const char *__restrict __format, ...); +typedef long int __time_t; +typedef long int __suseconds_t; +struct timeval + { + __time_t tv_sec; + __suseconds_t tv_usec; + }; +struct timezone + { + int tz_minuteswest; + int tz_dsttime; + }; +typedef struct timezone *__restrict __timezone_ptr_t; +extern int gettimeofday (struct timeval *__restrict __tv, + __timezone_ptr_t __tz) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))); + +typedef long int __jmp_buf[8]; +typedef struct + { + unsigned long int __val[(1024 / (8 * sizeof (unsigned long int)))]; + } __sigset_t; +struct __jmp_buf_tag + { + __jmp_buf __jmpbuf; + int __mask_was_saved; + __sigset_t __saved_mask; + }; +typedef struct __jmp_buf_tag jmp_buf[1]; + +extern int setjmp (jmp_buf __env) __attribute__ ((__nothrow__)); +extern void longjmp (struct __jmp_buf_tag __env[1], int __val) + __attribute__ ((__nothrow__)) __attribute__ ((__noreturn__)); + +extern int bar (void); + +int __attribute__ ((noinline, noclone)) +get_input (void) +{ + return 0; +} + +static jmp_buf buf; + +int foo (void) +{ + if (get_input ()) + longjmp(buf, 1); + return 0; +} + +volatile int z; + + +int main (void) +{ + struct timeval tv; + struct timezone tz; + + bar(); + if (setjmp (buf)) + return 1; + + if (!get_input ()) + { + gettimeofday (&tv, &tz); + z = 0; + printf ("This is from main %i\n", tz.tz_dsttime); + } + + foo (); + bar (); + bar (); + + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/pr51879-18.c b/gcc-4.9/gcc/testsuite/gcc.dg/pr51879-18.c index 95629f122..9b3cb80a4 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/pr51879-18.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/pr51879-18.c @@ -13,5 +13,5 @@ void bar (int c, int *p) *q = foo (); } -/* { dg-final { scan-tree-dump-times "foo \\(" 1 "pre"} } */ +/* { dg-final { scan-tree-dump-times "foo \\(" 1 "pre" { xfail *-*-* } } } */ /* { dg-final { cleanup-tree-dump "pre" } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/pr57233.c b/gcc-4.9/gcc/testsuite/gcc.dg/pr57233.c index 58c05348b..484844e49 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/pr57233.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/pr57233.c @@ -1,6 +1,7 @@ /* PR tree-optimization/57233 */ /* { dg-do run { target { ilp32 || lp64 } } } */ /* { dg-options "-O2" } */ +/* { dg-additional-options "-fno-common" { target hppa*-*-hpux* } } */ typedef unsigned V4 __attribute__((vector_size(4 * sizeof (int)))); typedef unsigned V8 __attribute__((vector_size(8 * sizeof (int)))); diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/pr59418.c b/gcc-4.9/gcc/testsuite/gcc.dg/pr59418.c index 114c1d383..257ce79f1 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/pr59418.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/pr59418.c @@ -3,7 +3,7 @@ /* { dg-do compile } */ /* { dg-options "-Os -g" } */ -/* { dg-options "-march=armv7-a -mfloat-abi=hard -Os -g" { target arm*-*-* } } */ +/* { dg-options "-march=armv7-a -mfloat-abi=hard -Os -g" { target { arm*-*-* && { ! arm_thumb1 } } } } */ extern int printf (const char *__format, ...); diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/pr61756.c b/gcc-4.9/gcc/testsuite/gcc.dg/pr61756.c new file mode 100644 index 000000000..4ca90448f --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/pr61756.c @@ -0,0 +1,14 @@ +/* PR target/61756 */ + +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +#include + +static volatile atomic_flag guard = ATOMIC_FLAG_INIT; + +void +try_atomic_flag_test_and_set (void) +{ + atomic_flag_test_and_set (&guard); +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/pr61776.c b/gcc-4.9/gcc/testsuite/gcc.dg/pr61776.c new file mode 100644 index 000000000..8768c546b --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/pr61776.c @@ -0,0 +1,27 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fprofile-generate" } */ + +#include + +int cond1, cond2; + +int goo() __attribute__((noinline)); + +int goo() { + if (cond1) + return 1; + else + return 2; +} + +jmp_buf env; +int foo() { + int a; + + setjmp(env); + if (cond2) + a = goo(); + else + a = 3; + return a; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/pr62004.c b/gcc-4.9/gcc/testsuite/gcc.dg/pr62004.c new file mode 100644 index 000000000..c994a411b --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/pr62004.c @@ -0,0 +1,47 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -fno-tree-tail-merge" } */ + +struct node +{ + struct node *next; + struct node *prev; +}; + +struct node node; + +struct head +{ + struct node *first; +}; + +struct head heads[5]; + +int k = 2; + +struct head *head = &heads[2]; + +int +main () +{ + struct node *p; + + node.next = (void*)0; + + node.prev = (void *)head; + + head->first = &node; + + struct node *n = head->first; + + struct head *h = &heads[k]; + + heads[2].first = n->next; + + if ((void*)n->prev == (void *)h) + p = h->first; + else + /* Dead tbaa-unsafe load from ((struct node *)&heads[2])->next. */ + p = n->prev->next; + + return !(p == (void*)0); +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/pr62030.c b/gcc-4.9/gcc/testsuite/gcc.dg/pr62030.c new file mode 100644 index 000000000..b8baf9343 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/pr62030.c @@ -0,0 +1,50 @@ +/* { dg-do run } */ +/* { dg-options "-O2" } */ + +extern void abort (void); + +struct node +{ + struct node *next; + struct node *prev; +}; + +struct node node; + +struct head +{ + struct node *first; +}; + +struct head heads[5]; + +int k = 2; + +struct head *head = &heads[2]; + +static int __attribute__((noinline)) +foo (void) +{ + node.prev = (void *)head; + head->first = &node; + + struct node *n = head->first; + struct head *h = &heads[k]; + struct node *next = n->next; + + if (n->prev == (void *)h) + h->first = next; + else + n->prev->next = next; + + n->next = h->first; + return n->next == &node; +} + +int +main (void) +{ + if (foo ()) + abort (); + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr61964.c b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr61964.c new file mode 100644 index 000000000..a03cfdc37 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr61964.c @@ -0,0 +1,33 @@ +/* { dg-do run } */ + +extern void abort (void); + +struct node { struct node *next, *prev; } node; +struct head { struct node *first; } heads[5]; +int k = 2; +struct head *head = &heads[2]; + +static int __attribute__((noinline)) +foo() +{ + node.prev = (void *)head; + head->first = &node; + + struct node *n = head->first; + struct head *h = &heads[k]; + + if (n->prev == (void *)h) + h->first = n->next; + else + n->prev->next = n->next; + + n->next = h->first; + return n->next == &node; +} + +int main() +{ + if (foo ()) + abort (); + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/ssa-copyprop-2.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/ssa-copyprop-2.c new file mode 100644 index 000000000..975701391 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/ssa-copyprop-2.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-Og -fdump-tree-optimized" } */ + +extern long long __sdt_unsp; +void +f(void) +{ + for (;;) + __asm__ ("%0" :: "i" (((!__extension__ (__builtin_constant_p ((((unsigned long long) (__typeof (__builtin_choose_expr (((__builtin_classify_type (0) + 3) & -4) == 4, (0), 0U))) __sdt_unsp) ) == 0) )) ? 1 : -1) )); +} + +/* { dg-final { scan-tree-dump-not "PHI" "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr62073.c b/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr62073.c new file mode 100644 index 000000000..15f2ad66b --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr62073.c @@ -0,0 +1,40 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-O1" } */ + +struct S0 +{ + int f7; +}; +struct S0 g_50; +int g_70; +int g_76; + +int foo (long long p_56, int * p_57) +{ + int *l_77; + int l_101; + + for (; g_70;) + { + int **l_78 = &l_77; + if (g_50.f7) + continue; + *l_78 = 0; + } + for (g_76 = 1; g_76 >= 0; g_76--) + { + int *l_90; + for (l_101 = 4; l_101 >= 0; l_101--) + if (l_101) + *l_90 = 0; + else + { + int **l_113 = &l_77; + *l_113 = p_57; + } + } + + return *l_77; +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ -- cgit v1.2.3