diff options
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gcc.dg')
66 files changed, 1596 insertions, 18 deletions
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/20141029-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/20141029-1.c new file mode 100644 index 000000000..b25af5769 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/20141029-1.c @@ -0,0 +1,28 @@ +/* { dg-do compile } */ +/* { dg-options "-fstrict-volatile-bitfields -fdump-rtl-final" } */ + +#define PERIPH (*(volatile struct system_periph *)0x81234) + +struct system_periph { + union { + unsigned short WORD; + struct { + unsigned short a:1; + unsigned short b:1; + unsigned short :5; + unsigned short c:1; + unsigned short :8; + } BIT; + } ALL; +}; + +void +foo() +{ + while (1) + { + PERIPH.ALL.BIT.a = 1; + } +} +/* { dg-final { scan-rtl-dump-times "mem/v(/.)*:HI" 4 "final" } } */ +/* { dg-final { cleanup-rtl-dump "final" } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/darwin-minversion-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/darwin-minversion-1.c index d8a3243bb..6221d617b 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/darwin-minversion-1.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/darwin-minversion-1.c @@ -2,7 +2,8 @@ /* { dg-options "-mmacosx-version-min=10.1" } */ /* { dg-do run { target *-*-darwin* } } */ -int main(void) +int +main () { #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ != 1010 fail me; diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/darwin-minversion-2.c b/gcc-4.9/gcc/testsuite/gcc.dg/darwin-minversion-2.c index fd4975a52..8e18d5273 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/darwin-minversion-2.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/darwin-minversion-2.c @@ -2,7 +2,8 @@ /* { dg-options "-mmacosx-version-min=10.1 -mmacosx-version-min=10.3" } */ /* { dg-do run { target *-*-darwin* } } */ -int main(void) +int +main () { #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ != 1030 fail me; diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/darwin-minversion-3.c b/gcc-4.9/gcc/testsuite/gcc.dg/darwin-minversion-3.c index d0c5934b4..4fcb9693c 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/darwin-minversion-3.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/darwin-minversion-3.c @@ -2,7 +2,8 @@ /* { dg-options "-mmacosx-version-min=10.4.10" } */ /* { dg-do compile { target *-*-darwin* } } */ -int main(void) +int +main () { #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ != 1040 fail me; diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/darwin-minversion-4.c b/gcc-4.9/gcc/testsuite/gcc.dg/darwin-minversion-4.c new file mode 100644 index 000000000..1cb42ebe3 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/darwin-minversion-4.c @@ -0,0 +1,12 @@ +/* Test that major versions greater than 9 work and have the additional 0. */ +/* { dg-options "-mmacosx-version-min=10.10.0" } */ +/* { dg-do compile { target *-*-darwin* } } */ + +int +main () +{ +#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ != 101000 + fail me; +#endif + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/fpomit-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/fpomit-1.c new file mode 100644 index 000000000..c5398070b --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/fpomit-1.c @@ -0,0 +1,25 @@ +/* { dg-do compile { target i?86-*-* x86_64-*-* } } */ +/* { dg-options "-O2 -fno-omit-frame-pointer -fshrink-wrap-frame-pointer -dA" } */ +/* { dg-final { scan-assembler-times "BLOCK 2.*push\[^\n\r\]*bp.*mov\[^\n\r\]*sp\[^\n\r\]*bp.*BLOCK 3" 1 } } */ +/* { dg-final { scan-assembler-times "pop\[^\n\r\]*bp" 1 } } */ + +/* Check there is 1 push, 1 pop and 1 mov-sp-to-bp. */ + +unsigned M; +int cond1, cond2; +extern void goo(); +extern void hoo(); +extern void ioo(); + +void foo() { + unsigned i; + for (i = 0; i <= M; i++) { + if (cond1) { + goo(); + } else if (cond2) { + hoo(); + } else { + ioo(); + } + } +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/fpomit-2.c b/gcc-4.9/gcc/testsuite/gcc.dg/fpomit-2.c new file mode 100644 index 000000000..25a99a92f --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/fpomit-2.c @@ -0,0 +1,41 @@ +/* { dg-do compile { target {{ i?86-*-* x86_64-*-* } && lp64 } } } */ +/* { dg-options "-O2 -fno-omit-frame-pointer -fshrink-wrap-frame-pointer -mno-omit-leaf-frame-pointer -fno-schedule-insns2" } */ +/* { dg-final { scan-assembler-not "mov\[^\n\r\]*bp" } } */ + +/* Check fp is the last register to use. */ + +int a[1000], b[1000]; + +void foo() { + int r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14; + + r1 = a[1]; + r2 = a[2]; + r3 = a[3]; + r4 = a[4]; + r5 = a[5]; + r6 = a[6]; + r7 = a[7]; + r8 = a[8]; + r9 = a[9]; + r10 = a[10]; + r11 = a[11]; + r12 = a[12]; + r13 = a[13]; + r14 = a[14]; + asm volatile ("" : : : "memory"); + b[1] = r1; + b[2] = r2; + b[3] = r3; + b[4] = r4; + b[5] = r5; + b[6] = r6; + b[7] = r7; + b[8] = r8; + b[9] = r9; + b[10] = r10; + b[11] = r11; + b[12] = r12; + b[13] = r13; + b[14] = r14; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/fpomit-3.c b/gcc-4.9/gcc/testsuite/gcc.dg/fpomit-3.c new file mode 100644 index 000000000..00f8ca331 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/fpomit-3.c @@ -0,0 +1,56 @@ +/* { dg-do compile { target i?86-*-* x86_64-*-* } } */ +/* { dg-options "-O2 -fno-omit-frame-pointer -fshrink-wrap-frame-pointer -dA" } */ +/* { dg-final { scan-assembler-times "BLOCK 2.*push\[^\n\r\]*bp.*mov\[^\n\r\]*sp\[^\n\r\]*bp.*BLOCK 3" 1 } } */ + +/* Check both loop1 and loop2 should not set fp free, and fp setting + will be promoted outside all the loops. */ +int a[1000], b[1000], cond1, cond2; +unsigned M, N; +extern void goo(); +int *p; + +void foo() { + int r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15; + unsigned i, j; + + for (i = 0; i <= M; i++) { + goo(); + if (__builtin_expect(cond1, 0)) { + if (__builtin_expect(cond2, 0)) { + for (j = 0; j <= N; j++) { + r1 = a[1]; + r2 = a[2]; + r3 = a[3]; + r4 = a[4]; + r5 = a[5]; + r6 = a[6]; + r7 = a[7]; + r8 = a[8]; + r9 = a[9]; + r10 = a[10]; + r11 = a[11]; + r12 = a[12]; + r13 = a[13]; + r14 = a[14]; + r15 = a[15]; + *p = 3; + b[1] = r1; + b[2] = r2; + b[3] = r3; + b[4] = r4; + b[5] = r5; + b[6] = r6; + b[7] = r7; + b[8] = r8; + b[9] = r9; + b[10] = r10; + b[11] = r11; + b[12] = r12; + b[13] = r13; + b[14] = r14; + b[15] = r15; + } + } + } + } +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/fpomit-4.c b/gcc-4.9/gcc/testsuite/gcc.dg/fpomit-4.c new file mode 100644 index 000000000..cff83f2db --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/fpomit-4.c @@ -0,0 +1,64 @@ +/* { dg-do compile { target i?86-*-* x86_64-*-* } } */ +/* { dg-options "-O2 -fno-omit-frame-pointer -fshrink-wrap-frame-pointer -fdump-rtl-ira-details-blocks" } */ +/* { dg-final { scan-assembler-times "lea\[^\n\r\]*bp" 2 } } */ +/* { dg-final { scan-rtl-dump-not "loop 1\[^\n\r\]*fp" "ira" } } */ +/* { dg-final { cleanup-rtl-dump "ira" } } */ + +/* Check the fp setting of goo and hoo inside loops could be + promoted to loop header. */ + +int a[1000], b[1000], cond1, cond2, x, y; +unsigned M, N; +extern void goo(); +extern void hoo(); + +void foo() { + int r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15; + unsigned i, j; + + r1 = a[1]; + r2 = a[2]; + r3 = a[3]; + r4 = a[4]; + r5 = a[5]; + r6 = a[6]; + r7 = a[7]; + r8 = a[8]; + r9 = a[9]; + r10 = a[10]; + r11 = a[11]; + r12 = a[12]; + r13 = a[13]; + r14 = a[14]; + r15 = a[15]; + if (cond1) + hoo(); + b[1] = r1; + b[2] = r2; + b[3] = r3; + b[4] = r4; + b[5] = r5; + b[6] = r6; + b[7] = r7; + b[8] = r8; + b[9] = r9; + b[10] = r10; + b[11] = r11; + b[12] = r12; + b[13] = r13; + b[14] = r14; + b[15] = r15; + + for (i = 0; i < M; i++) { + r1 = x; + goo(); + y = r1; + if (cond1) { + for (j = 0; j < N; j++) { + r2 = a[j]; + hoo(); + b[j] = r2; + } + } + } +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/fpomit-5.c b/gcc-4.9/gcc/testsuite/gcc.dg/fpomit-5.c new file mode 100644 index 000000000..7eba71e21 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/fpomit-5.c @@ -0,0 +1,59 @@ +/* { dg-do compile { target i?86-*-* x86_64-*-* } } */ +/* { dg-options "-O2 -fno-omit-frame-pointer -fshrink-wrap-frame-pointer -fdump-rtl-ira-details-blocks" } */ +/* { dg-final { scan-assembler-times "lea\[^\n\r\]*bp" 1 } } */ +/* { dg-final { scan-rtl-dump "loop 1\[^\n\r\]*fp" "ira" } } */ +/* { dg-final { scan-rtl-dump-not "loop 2\[^\n\r\]*fp" "ira" } } */ +/* { dg-final { cleanup-rtl-dump "ira" } } */ + +/* Check loop1 should set fp_is_free and loop2 should not. */ +int a[1000], b[1000], cond1, cond2, x, y; +unsigned M, N; +extern void goo(); +int *p; + +void foo() { + int r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15; + unsigned i, j; + + for (i = 0; i < M; i++) { + r1 = a[1]; + r2 = a[2]; + r3 = a[3]; + r4 = a[4]; + r5 = a[5]; + r6 = a[6]; + r7 = a[7]; + r8 = a[8]; + r9 = a[9]; + r10 = a[10]; + r11 = a[11]; + r12 = a[12]; + r13 = a[13]; + r14 = a[14]; + r15 = a[15]; + *p = 3; + b[1] = r1; + b[2] = r2; + b[3] = r3; + b[4] = r4; + b[5] = r5; + b[6] = r6; + b[7] = r7; + b[8] = r8; + b[9] = r9; + b[10] = r10; + b[11] = r11; + b[12] = r12; + b[13] = r13; + b[14] = r14; + b[15] = r15; + + if (cond1) { + for (j = 0; j < N; j++) { + r2 = a[j]; + goo(); + b[j] = r2; + } + } + } +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/fpomit-6.c b/gcc-4.9/gcc/testsuite/gcc.dg/fpomit-6.c new file mode 100644 index 000000000..42b7c6a28 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/fpomit-6.c @@ -0,0 +1,50 @@ +/* { dg-do compile { target {{ i?86-*-* x86_64-*-* } && lp64 } } } */ +/* { dg-options "-O2 -fno-omit-frame-pointer -fshrink-wrap-frame-pointer -fno-schedule-insns2 -fdisable-rtl-ce1 -fdisable-rtl-ce2 -fdisable-rtl-ce3 -ffixed-ax -fdump-rtl-ira-details-blocks" } */ +/* { dg-final { scan-assembler "mov\[^\n\r\]*a\\+56\[^\n\r\]*bp\[^\n\r\]*\[\n\r\]\[^\n\r\]*mov\[^\n\r\]*bp\[^\n\r\]*b\\+56" } } */ +/* { dg-final { scan-rtl-dump "loop 1\[^\n\r\]*fp" "ira" } } */ +/* { dg-final { cleanup-rtl-dump "ira" } } */ + +/* Check loop1 should set fp free, and lra could use fp too. */ +int a[1000], b[1000], M, N, cond1, cond2, cond3; +extern void goo(); +int *p; + +void foo() { + int r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15; + int i, j; + + r15 = a[15]; + for (i = 0; i < M; i++) { + if (__builtin_expect(cond1, 0)) + if (__builtin_expect(cond2, 0)) + goo(); + r1 = a[1]; + r2 = a[2]; + r3 = a[3]; + r4 = a[4]; + r5 = a[5]; + r6 = a[6]; + r7 = a[7]; + r8 = a[8]; + r9 = a[9]; + r10 = a[10]; + r11 = a[11]; + r12 = a[12]; + asm volatile ("" : : : "memory"); + b[14] = a[14]; + asm volatile ("" : : : "memory"); + b[1] = r1; + b[2] = r2; + b[3] = r3; + b[4] = r4; + b[5] = r5; + b[6] = r6; + b[7] = r7; + b[8] = r8; + b[9] = r9; + b[10] = r10; + b[11] = r11; + b[12] = r12; + } + b[15] = r15; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/fpomit-7.c b/gcc-4.9/gcc/testsuite/gcc.dg/fpomit-7.c new file mode 100644 index 000000000..fa466424f --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/fpomit-7.c @@ -0,0 +1,50 @@ +/* { dg-do compile { target i?86-*-* x86_64-*-* } } */ +/* { dg-options "-O2 -fno-omit-frame-pointer -fshrink-wrap-frame-pointer -fno-schedule-insns2 -fdisable-rtl-ce1 -fdisable-rtl-ce2 -fdisable-rtl-ce3 -ffixed-ax -dA" } */ +/* { dg-final { scan-assembler-times "BLOCK 2.*push\[^\n\r\]*bp.*mov\[^\n\r\]*sp\[^\n\r\]*bp.*BLOCK 3" 1 } } */ + +/* Check loop1 should not set fp free, and lra should not use fp too. */ +int a[1000], b[1000], cond1, cond2, cond3; +unsigned M, N; +extern void goo(); +int *p; + +void foo() { + int r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15; + unsigned i, j; + + r15 = a[15]; + for (i = 0; i <= M; i++) { + goo(); + goo(); + goo(); + goo(); + r1 = a[1]; + r2 = a[2]; + r3 = a[3]; + r4 = a[4]; + r5 = a[5]; + r6 = a[6]; + r7 = a[7]; + r8 = a[8]; + r9 = a[9]; + r10 = a[10]; + r11 = a[11]; + r12 = a[12]; + asm volatile ("" : : : "memory"); + b[14] = a[14]; + asm volatile ("" : : : "memory"); + b[1] = r1; + b[2] = r2; + b[3] = r3; + b[4] = r4; + b[5] = r5; + b[6] = r6; + b[7] = r7; + b[8] = r8; + b[9] = r9; + b[10] = r10; + b[11] = r11; + b[12] = r12; + } + b[15] = r15; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/fpomit-8.c b/gcc-4.9/gcc/testsuite/gcc.dg/fpomit-8.c new file mode 100644 index 000000000..471cdf5c5 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/fpomit-8.c @@ -0,0 +1,84 @@ +/* { dg-do run { target {{ i?86-*-* x86_64-*-* } && lp64 } } } */ +/* { dg-options "-O2 -fno-omit-frame-pointer -fshrink-wrap-frame-pointer" } */ +/* { dg-output "stack_depth = 8" } */ + +#include <stdio.h> + +void* address[1000]; +int sizes[1000]; +int N; +int main(); +void *main_ret_address; + +__attribute((noinline)) int +get_stack_traces (void **result) +{ + void **sp = (void**) __builtin_frame_address (0); + int n = 0; + while (sp) { + if ((*(char **)(sp+1)) == main_ret_address) + return n; + + void **next_sp = (void**) *sp; + result[n] = *(sp+1); + if (next_sp > sp) + sizes[n] = (char*)next_sp - (char*)sp; + else + sizes[n] = 0; + sp = next_sp; + n++; + } + return n; +} + +__attribute__((noinline)) int bar(int level) +{ + int a[100]; + + int i; + + if (level == 0) + { + N = get_stack_traces (address); + return 0; + } + + for (i = 0; i < 100; i++) + a[i] = i + 10; + + return bar (level - 1) + a[0] + a[99]; +} + +__attribute__((noinline)) int foo() +{ + + int a[100]; + + int i; + + for (i = 0; i < 100; i++) + a[i] = i + 10; + + + return bar (5) + a[0] + a[99]; +} + + +int main() +{ + int i, n; + + main_ret_address = __builtin_return_address (0); + n = foo(); + + fprintf (stderr, "return value = %d, stack_depth = %d\n", n, N); + + for (i = 0; i < N; i++) + { + fprintf (stderr, "Frame[%d]: addr = %p, stack_size = %d\n", i, + address[i], sizes[i]); + + } + + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/fpomit-9.c b/gcc-4.9/gcc/testsuite/gcc.dg/fpomit-9.c new file mode 100644 index 000000000..7c1e8b85d --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/fpomit-9.c @@ -0,0 +1,23 @@ +/* { dg-do compile { target {{ i?86-*-* x86_64-*-* } && lp64 } } } */ +/* { dg-options "-O2 -fno-omit-frame-pointer -fshrink-wrap-frame-pointer -fno-schedule-insns2" } */ +/* { dg-final { scan-assembler-not "push" } } */ +/* { dg-final { scan-assembler-not "pop" } } */ + +/* Check -fshrink-wrap-frame-pointer can enable omitting leaf frame pointer + if -mno-omit-leaf-frame-pointer is not specified explicitly. */ + +int a[1000], b[1000]; + +void foo() { + int r1, r2, r3, r4; + + r1 = a[1]; + r2 = a[2]; + r3 = a[3]; + r4 = a[4]; + asm volatile ("" : : : "memory"); + b[1] = r1; + b[2] = r2; + b[3] = r3; + b[4] = r4; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/ipa/PR64559.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/PR64559.c new file mode 100644 index 000000000..463afdc26 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/PR64559.c @@ -0,0 +1,39 @@ +/* { dg-do compile } */ +/* { dg-options "-Os" } */ + +int a, b, c, d; + +struct S +{ + int f0; +}; + +static int +fn1 (int p) +{ + return p == 0 || a; +} + +static int +fn2 () +{ + d = fn1 (c); + return 0; +} + +static int +fn3 (struct S p) +{ + p.f0 || fn2 (); + if (fn1 (1)) + b = 0; + return 0; +} + +int +main () +{ + struct S e = { 1 }; + fn3 (e); + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/ipa/pr61986.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/pr61986.c new file mode 100644 index 000000000..8d2f658b8 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/pr61986.c @@ -0,0 +1,48 @@ +/* { dg-do compile } */ +/* { dg-options "-O3" } */ + +int a, b, c; + +struct S +{ + int f0; + int f1; +} d; + +static int fn2 (struct S); +void fn3 (struct S); + +void +fn1 (struct S p) +{ + struct S h = { 0, 0 }; + fn3 (p); + fn2 (h); +} + +int +fn2 (struct S p) +{ + struct S j = { 0, 0 }; + fn3 (p); + fn2 (j); + return 0; +} + +void +fn3 (struct S p) +{ + for (; b; a++) + c = p.f0; + fn1 (d); +} + +void +fn4 () +{ + for (;;) + { + struct S f = { 0, 0 }; + fn1 (f); + } +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/ipa/pr63551.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/pr63551.c new file mode 100644 index 000000000..48b020aee --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/pr63551.c @@ -0,0 +1,33 @@ +/* { dg-do run } */ +/* { dg-options "-Os" } */ + +union U +{ + unsigned int f0; + int f1; +}; + +int a, d; + +void +fn1 (union U p) +{ + if (p.f1 <= 0) + if (a) + d = 0; +} + +void +fn2 () +{ + d = 0; + union U b = { 4294967286U }; + fn1 (b); +} + +int +main () +{ + fn2 (); + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/ipa/pr64041.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/pr64041.c new file mode 100644 index 000000000..4877b4b68 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/pr64041.c @@ -0,0 +1,64 @@ +/* { dg-do run } */ +/* { dg-options "-O2" } */ + +int printf (const char *, ...); + +int a, b = 1, d; + +union U1 +{ + unsigned int f0; + int f1; +}; + +union U2 +{ + int f2; + int f3; +} c; + +int +fn1 (int p) +{ + int t = p && a || p && a && p; + return t ? t : a; +} + +unsigned +fn2 (union U1 p1, union U2 p2) +{ + if (p1.f1 <= 0) + { + for (; p2.f2;) + c.f2 = 0; + p2.f2 = fn1 (d); + } + return p2.f3; +} + +int g = 0; + +int +foo () +{ + if (b) + { + union U1 f = { 0xFFFFFFFFU }; + + fn2 (f, c); + } + g = 1; + return 0; +} + + +int +main () +{ + foo (); + + if (g == 0) + __builtin_abort (); + + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/option_no-pie.c b/gcc-4.9/gcc/testsuite/gcc.dg/option_no-pie.c new file mode 100644 index 000000000..b5d29095a --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/option_no-pie.c @@ -0,0 +1,7 @@ +/* { dg-do link { target pie } } */ +/* { dg-options "-no-pie" } */ + +int main(void) +{ + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/pr51879-12.c b/gcc-4.9/gcc/testsuite/gcc.dg/pr51879-12.c index 1b25e296f..7490e33f0 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/pr51879-12.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/pr51879-12.c @@ -24,6 +24,6 @@ foo (int y) baz (a); } -/* { dg-final { scan-tree-dump-times "bar \\(" 1 "pre"} } */ -/* { dg-final { scan-tree-dump-times "bar2 \\(" 1 "pre"} } */ +/* { dg-final { scan-tree-dump-times "bar \\(" 1 "pre" { xfail *-*-* } } } */ +/* { dg-final { scan-tree-dump-times "bar2 \\(" 1 "pre" { xfail *-*-* } } } */ /* { dg-final { cleanup-tree-dump "pre" } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/pr52769.c b/gcc-4.9/gcc/testsuite/gcc.dg/pr52769.c new file mode 100644 index 000000000..138cecb14 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/pr52769.c @@ -0,0 +1,24 @@ +/* PR c/52769 */ +/* { dg-do run } */ +/* { dg-options "-O3" } */ + +typedef struct +{ + int should_be_zero; + char s[6]; + int x; +} foo_t; + +int +main (void) +{ + volatile foo_t foo = { + .s = "123456", + .x = 2 + }; + + if (foo.should_be_zero != 0) + __builtin_abort (); + + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/pr56724-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/pr56724-1.c new file mode 100644 index 000000000..4276c3f15 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/pr56724-1.c @@ -0,0 +1,33 @@ +/* PR c/56724 */ +/* { dg-do compile } */ +/* { dg-options "-Wtraditional-conversion" } */ + +extern void foo (int p[2][]); /* { dg-error "array type has incomplete element type" } */ +extern void foo_i (int, int); +extern void foo_u (unsigned int); +extern void foo_f (int, float); +extern void foo_ll (long long); +extern void foo_cd (int, int, __complex__ double); +extern signed char sc; +extern int i; +extern unsigned int u; +extern float f; +extern double d; +extern __complex__ double cd; + +void +fn () +{ + int p[1][1]; + foo (p); /* { dg-error "8:type of formal parameter" } */ + foo_i (1, f); /* { dg-warning "13:passing argument" } */ + foo_i (1, cd); /* { dg-warning "13:passing argument" } */ + foo_cd (1, 2, f); /* { dg-warning "17:passing argument" } */ + foo_f (9, i); /* { dg-warning "13:passing argument" } */ + foo_cd (2, 2, i); /* { dg-warning "17:passing argument" } */ + foo_f (2, cd); /* { dg-warning "13:passing argument" } */ + foo_f (2, d); /* { dg-warning "13:passing argument" } */ + foo_ll (sc); /* { dg-warning "11:passing argument" } */ + foo_u (i); /* { dg-warning "10:passing argument" } */ + foo_i (1, u); /* { dg-warning "13:passing argument" } */ +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/pr56724-2.c b/gcc-4.9/gcc/testsuite/gcc.dg/pr56724-2.c new file mode 100644 index 000000000..4abb7d899 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/pr56724-2.c @@ -0,0 +1,31 @@ +/* PR c/56724 */ +/* { dg-do compile } */ +/* { dg-options "-Wc++-compat -Wpedantic" } */ + +enum E1 { A }; +enum E2 { B }; +extern void foo_E (enum E1); +extern void foo_v (void *p); +extern void foo_sc (int, int, signed char *); +extern unsigned char *uc; +extern signed char sc; +extern const signed char *csc; +extern float *f; + +void +foo (void) +{ + void (*fp)(void); + const void (*ffp)(void); + foo_v (fp); /* { dg-warning "10:ISO C forbids passing argument" } */ + foo_E (B); /* { dg-warning "10:enum conversion when passing argument" } */ + foo_sc (1, 2, uc); /* { dg-warning "17:pointer targets in passing argument" } */ + foo_sc (1, 2, f); /* { dg-warning "17:passing argument" } */ + foo_sc (1, 2, sc); /* { dg-warning "17:passing argument" } */ + foo_sc (uc, 2, &sc); /* { dg-warning "11:passing argument" } */ + foo_sc (1, 2, csc); /* { dg-warning "17:passing argument" } */ +} + +typedef void (*fp)(void); +typedef void (*nrfp)(void) __attribute__((noreturn)); +void f1 (nrfp); void f2 (fp x) { f1 (x); } extern int e; /* { dg-warning "38:passing argument" } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/pr61053.c b/gcc-4.9/gcc/testsuite/gcc.dg/pr61053.c index 4fd531974..e27042030 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/pr61053.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/pr61053.c @@ -31,17 +31,17 @@ _Alignas (long double) int ild; _Alignas (char) long int lic; /* { dg-error "cannot reduce alignment" } */ _Alignas (short int) long int lis; /* { dg-error "cannot reduce alignment" } */ -_Alignas (int) long int lii; /* { dg-error "cannot reduce alignment" "" { target { ! { ia32 } } } } */ +_Alignas (int) long int lii; /* { dg-error "cannot reduce alignment" "" { target { ! { ilp32 } } } } */ _Alignas (long int) long int lil; _Alignas (long long int) long int lill; -_Alignas (float) long int lif; /* { dg-error "cannot reduce alignment" "" { target { ! { ia32 } } } } */ +_Alignas (float) long int lif; /* { dg-error "cannot reduce alignment" "" { target { ! { ilp32 } } } } */ _Alignas (double) long int lid; _Alignas (long double) long int lild; _Alignas (char) long long int llic; /* { dg-error "cannot reduce alignment" } */ _Alignas (short int) long long int llis; /* { dg-error "cannot reduce alignment" } */ _Alignas (int) long long int llii; /* { dg-error "cannot reduce alignment" "" { target { ! { ia32 } } } } */ -_Alignas (long int) long long int llil; +_Alignas (long int) long long int llil; /* { dg-error "cannot reduce alignment" "" { target { x32 } } } */ _Alignas (long long int) long long int llill; _Alignas (float) long long int llif; /* { dg-error "cannot reduce alignment" "" { target { ! { ia32 } } } } */ _Alignas (double) long long int llid; @@ -59,7 +59,7 @@ _Alignas (long double) float fld; _Alignas (char) double dc; /* { dg-error "cannot reduce alignment" } */ _Alignas (short int) double ds; /* { dg-error "cannot reduce alignment" } */ _Alignas (int) double di; /* { dg-error "cannot reduce alignment" "" { target { ! { ia32 } } } } */ -_Alignas (long int) double dl; +_Alignas (long int) double dl; /* { dg-error "cannot reduce alignment" "" { target { x32 } } } */ _Alignas (long long int) double dll; _Alignas (float) double df; /* { dg-error "cannot reduce alignment" "" { target { ! { ia32 } } } } */ _Alignas (double) double dd; diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/pr62167-run.c b/gcc-4.9/gcc/testsuite/gcc.dg/pr62167-run.c new file mode 100644 index 000000000..37214a3ec --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/pr62167-run.c @@ -0,0 +1,47 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -ftree-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/pr62167.c b/gcc-4.9/gcc/testsuite/gcc.dg/pr62167.c new file mode 100644 index 000000000..f8c31a079 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/pr62167.c @@ -0,0 +1,50 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -ftree-tail-merge -fdump-tree-pre" } */ + +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); +} + +/* { dg-final { scan-tree-dump-not "Removing basic block" "pre"} } */ +/* { dg-final { cleanup-tree-dump "pre" } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/pr62294.c b/gcc-4.9/gcc/testsuite/gcc.dg/pr62294.c new file mode 100644 index 000000000..c6ec5a753 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/pr62294.c @@ -0,0 +1,10 @@ +/* PR c/62294 */ +/* { dg-do compile } */ + +#include "pr62294.h" + +void +fn (int *u) +{ + foo (u); /* { dg-error "passing argument 1 of .bar. from incompatible pointer type" } */ +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/pr62294.h b/gcc-4.9/gcc/testsuite/gcc.dg/pr62294.h new file mode 100644 index 000000000..9be45adea --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/pr62294.h @@ -0,0 +1,3 @@ +#pragma GCC system_header +#define foo bar +extern void foo (float *); diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/pr63186.c b/gcc-4.9/gcc/testsuite/gcc.dg/pr63186.c new file mode 100644 index 000000000..b3648757c --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/pr63186.c @@ -0,0 +1,30 @@ +/* { dg-do link } */ +/* { dg-options "-O2" } */ +void *a; +int b, c, d; + +void +bar () +{ + switch (c) + { + case 0: + lab: + __asm__ (""); + return; + default: + break; + } + b = 0; + d = 0; + a = &&lab; +} + +void +foo () +{ + bar (); +} +main() +{ +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/pr63284.c b/gcc-4.9/gcc/testsuite/gcc.dg/pr63284.c new file mode 100644 index 000000000..dc7fc28b8 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/pr63284.c @@ -0,0 +1,42 @@ +/* PR debug/63284 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fcompare-debug" } */ + +int a[10], *b, *d, c, f; +int fn2 (void); +void fn3 (void); +void fn4 (int); + +static int +fn1 (int x) +{ + int e = a[0]; + if (e) + return 1; + if (b) + switch (x) + { + case 1: + if (d) + e = fn2 (); + else + fn3 (); + break; + case 0: + if (d) + { + fn3 (); + if (c) + fn4 (1); + } + else + fn4 (0); + } + return e; +} + +void +fn6 (void) +{ + f = fn1 (0); +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/pr63342.c b/gcc-4.9/gcc/testsuite/gcc.dg/pr63342.c new file mode 100644 index 000000000..499d508c1 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/pr63342.c @@ -0,0 +1,26 @@ +/* PR debug/63342 */ +/* { dg-do compile } */ +/* { dg-options "-g -O2" } */ +/* { dg-additional-options "-fpic" { target fpic } } */ + +static __thread double u[9], v[9]; + +void +foo (double **p, double **q) +{ + *p = u; + *q = v; +} + +double +bar (double x) +{ + int i; + double s = 0.0; + for (i = 0; i < 9; i++) + { + double a = x + v[i]; + s += u[i] * a * a; + } + return s; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/pr63538.c b/gcc-4.9/gcc/testsuite/gcc.dg/pr63538.c new file mode 100644 index 000000000..4fa199af7 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/pr63538.c @@ -0,0 +1,14 @@ +/* PR63538 is about not using 64-bit addresses for .lrodata accesses when it + involves STRING_CSTs. */ +/* { dg-do compile { target x86_64-*-* } } */ +/* { dg-options "-O2 -mcmodel=medium -mlarge-data-threshold=0" { target x86_64-*-* } } */ + +#include <stdio.h> + +const char *str = "Hello World"; + +int main() { + printf("str = %p %s\n",str, str); + return 0; +} +/* { dg-final { scan-assembler-not "movl" } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/pr63665.c b/gcc-4.9/gcc/testsuite/gcc.dg/pr63665.c new file mode 100644 index 000000000..046ecae7c --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/pr63665.c @@ -0,0 +1,18 @@ +/* { dg-do run } */ +/* { dg-require-effective-target int32plus } */ +/* { dg-options "-O -fno-tree-ccp -fno-tree-fre -fno-tree-copy-prop -fwrapv" } */ + +static inline int +test5 (int x) +{ + int y = 0x80000000; + return x + y; +} + +int +main () +{ + if (test5 (0x80000000) != 0) + __builtin_abort (); + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/pr64536.c b/gcc-4.9/gcc/testsuite/gcc.dg/pr64536.c new file mode 100644 index 000000000..9a7982997 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/pr64536.c @@ -0,0 +1,67 @@ +/* PR rtl-optimization/64536 */ +/* { dg-do link } */ +/* { dg-options "-O2" } */ +/* { dg-additional-options "-fPIC" { target fpic } } */ + +struct S { long q; } *h; +long a, b, g, j, k, *c, *d, *e, *f, *i; +long *baz (void) +{ + asm volatile ("" : : : "memory"); + return e; +} + +void +bar (int x) +{ + int y; + for (y = 0; y < x; y++) + { + switch (b) + { + case 0: + case 2: + a++; + break; + case 3: + a++; + break; + case 1: + a++; + } + if (d) + { + f = baz (); + g = k++; + if (&h->q) + { + j = *f; + h->q = *f; + } + else + i = (long *) (h->q = *f); + *c++ = (long) f; + e += 6; + } + else + { + f = baz (); + g = k++; + if (&h->q) + { + j = *f; + h->q = *f; + } + else + i = (long *) (h->q = *f); + *c++ = (long) f; + e += 6; + } + } +} + +int +main () +{ + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/pr64563.c b/gcc-4.9/gcc/testsuite/gcc.dg/pr64563.c new file mode 100644 index 000000000..7223349c4 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/pr64563.c @@ -0,0 +1,14 @@ +/* PR tree-optimization/64563 */ +/* { dg-do compile } */ +/* { dg-options "-Os -Wtype-limits" } */ + +int a, b, c, d, f; +unsigned int e; + +void +foo (void) +{ + d = b = (a != (e | 4294967288UL)); + if (!d) + c = f || b; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tm/pr64391.c b/gcc-4.9/gcc/testsuite/gcc.dg/tm/pr64391.c new file mode 100644 index 000000000..235118aa3 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tm/pr64391.c @@ -0,0 +1,10 @@ +/* PR middle-end/64391 */ +/* { dg-do compile } */ +/* { dg-options "-fgnu-tm" } */ + +void +foo (void) +{ +#pragma GCC ivdep + while (1); +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/torture/float128-exact-underflow.c b/gcc-4.9/gcc/testsuite/gcc.dg/torture/float128-exact-underflow.c new file mode 100644 index 000000000..ea11f26e2 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/torture/float128-exact-underflow.c @@ -0,0 +1,41 @@ +/* Test that exact underflow in __float128 signals the underflow + exception if trapping is enabled, but does not raise the flag + otherwise. */ + +/* { dg-do run { target i?86-*-*gnu* x86_64-*-*gnu* } } */ +/* { dg-options "-D_GNU_SOURCE" } */ +/* { dg-require-effective-target fenv_exceptions } */ + +#include <fenv.h> +#include <setjmp.h> +#include <signal.h> +#include <stdlib.h> + +volatile sig_atomic_t caught_sigfpe; +sigjmp_buf buf; + +static void +handle_sigfpe (int sig) +{ + caught_sigfpe = 1; + siglongjmp (buf, 1); +} + +int +main (void) +{ + volatile __float128 a = 0x1p-16382q, b = 0x1p-2q; + volatile __float128 r; + r = a * b; + if (fetestexcept (FE_UNDERFLOW)) + abort (); + if (r != 0x1p-16384q) + abort (); + feenableexcept (FE_UNDERFLOW); + signal (SIGFPE, handle_sigfpe); + if (sigsetjmp (buf, 1) == 0) + r = a * b; + if (!caught_sigfpe) + abort (); + exit (0); +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr62031.c b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr62031.c new file mode 100644 index 000000000..f0dcef44b --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr62031.c @@ -0,0 +1,52 @@ +/* { dg-do run } */ + +#include <stdlib.h> + +#define NUM_OF_STATES 4 +typedef unsigned int entry_t[2]; +typedef struct entries_item { entry_t metricEntries_[0]; } entries_item_t; + +void __attribute__((noinline,noclone)) +test_00(size_t numOfStates, entries_item_t* p_bm, + const unsigned int* polyArray, + size_t polyArraySize) +{ + size_t idx; + unsigned int hlp0, hlp1; + for (idx = 0; idx < numOfStates; ++idx) + { + size_t idy; + + hlp0 = (idx << 1) | 0x00; + hlp1 = (idx << 1) | 0x01; + p_bm->metricEntries_[idx][0] = 0; + p_bm->metricEntries_[idx][1] = 0; + for (idy = 0; idy < polyArraySize; ++idy) + { + p_bm->metricEntries_[idx][0] + |= __builtin_parity(hlp0 & polyArray[idy]) << idy; + p_bm->metricEntries_[idx][1] + |= __builtin_parity(hlp1 & polyArray[idy]) << idy; + } + } +} + +int main() +{ + unsigned int polyArray[] = { 0x07, 0x05 }; + entries_item_t* pBranchMetrics; + pBranchMetrics = malloc(sizeof(entry_t) * NUM_OF_STATES); + test_00(NUM_OF_STATES, pBranchMetrics, polyArray, + sizeof(polyArray) / sizeof(polyArray[0])); + if (pBranchMetrics->metricEntries_[0][0] != 0 + || pBranchMetrics->metricEntries_[0][1] != 3 + || pBranchMetrics->metricEntries_[1][0] != 1 + || pBranchMetrics->metricEntries_[1][1] != 2 + || pBranchMetrics->metricEntries_[2][0] != 3 + || pBranchMetrics->metricEntries_[2][1] != 0 + || pBranchMetrics->metricEntries_[3][0] != 2 + || pBranchMetrics->metricEntries_[3][1] != 1) + abort (); + free(pBranchMetrics); + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr62238.c b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr62238.c new file mode 100644 index 000000000..de8951aae --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr62238.c @@ -0,0 +1,30 @@ +/* { dg-do run } */ + +int a[4], b, c, d; + +int +fn1 (int p) +{ + for (; d; d++) + { + unsigned int h; + for (h = 0; h < 3; h++) + { + if (a[c+c+h]) + { + if (p) + break; + return 0; + } + b = 0; + } + } + return 0; +} + +int +main () +{ + fn1 (0); + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr63380-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr63380-1.c new file mode 100644 index 000000000..29deface8 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr63380-1.c @@ -0,0 +1,15 @@ +/* { dg-do run } */ + +int a = 0, b = 1, c = 0, d = 1, e, f, g, h; +int +main () +{ + e = 1 >> d; + f = ((31 / (1 > e)) || c) / 2; + g = b || a; + h = 31 / g; + if (!h) + __builtin_abort(); + return 0; +} + diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr63380-2.c b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr63380-2.c new file mode 100644 index 000000000..f4cbc43eb --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr63380-2.c @@ -0,0 +1,10 @@ +/* { dg-do run } */ + +int a = 0, b = 0, c = 0, d, e; +int +main (void) +{ + d = ((20 % (1 != b)) && c) + 2147483647; + e = 20 % (a >= 0); + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr63738.c b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr63738.c new file mode 100644 index 000000000..06ede5461 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr63738.c @@ -0,0 +1,27 @@ +/* { dg-do compile } */ + +#include <setjmp.h> + +struct longjmp_buffer { + jmp_buf buf; +}; + +void plouf(); + +extern long interprete() +{ + long * sp; + int i; + long *args; + int n; + + struct longjmp_buffer raise_buf; + setjmp (raise_buf.buf); + + plouf(); + sp -= 4; + for (i = 0; i < n; i++) + args[i] = sp[10-i]; + plouf(); + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr64365.c b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr64365.c new file mode 100644 index 000000000..169993e6d --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr64365.c @@ -0,0 +1,37 @@ +/* { dg-do run } */ +/* { dg-require-effective-target int32plus } */ + +extern void abort (void); +extern int memcmp (const void * , const void *, __SIZE_TYPE__); + +void __attribute__((noinline,noclone)) +foo(int *in) +{ + int i; + for (i = 62; i >= 10; i--) + { + in[i - 8] -= in[i]; + in[i - 5] += in[i] * 2; + in[i - 4] += in[i]; + } +} + +int main() +{ + int x[64]; + int y[64] = { 0, 1, -2380134, -1065336, -1026376, 3264240, 3113534, 2328130, 3632054, 3839634, 2380136, 1065339, 1026380, 1496037, 1397286, 789976, 386408, 450984, 597112, 497464, 262008, 149184, 194768, 231519, 173984, 87753, 60712, 82042, 87502, 60014, 30050, 25550, 33570, 32386, 20464, 10675, 10868, 13329, 11794, 6892, 3988, 4564, 5148, 4228, 2284, 1568, 1848, 1943, 1472, 741, 628, 702, 714, 474, 230, 234, 238, 242, 120, 59, 60, 61, 62, 63 }; + int i; + + for (i = 0; i < 64; ++i) + { + x[i] = i; + __asm__ volatile (""); + } + + foo (x); + + if (memcmp (x, y, sizeof (x)) != 0) + abort (); + + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/torture/vshuf-4.inc b/gcc-4.9/gcc/testsuite/gcc.dg/torture/vshuf-4.inc index c50fa8e9d..d0cb7387c 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/torture/vshuf-4.inc +++ b/gcc-4.9/gcc/testsuite/gcc.dg/torture/vshuf-4.inc @@ -23,7 +23,8 @@ T (19, 3, 2, 1, 0) \ T (20, 0, 4, 1, 5) \ T (21, 2, 6, 3, 7) \ T (22, 1, 2, 3, 0) \ -T (23, 2, 1, 0, 3) +T (23, 2, 1, 0, 3) \ +T (24, 2, 5, 6, 3) #define EXPTESTS \ T (116, 1, 2, 4, 3) \ T (117, 7, 3, 3, 0) \ @@ -31,7 +32,6 @@ T (118, 5, 3, 2, 7) \ T (119, 0, 3, 5, 6) \ T (120, 0, 0, 1, 5) \ T (121, 4, 6, 2, 1) \ -T (122, 2, 5, 6, 3) \ T (123, 4, 6, 3, 2) \ T (124, 4, 7, 5, 6) \ T (125, 0, 4, 2, 4) \ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/cold_partition_label.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/cold_partition_label.c index a03aad7f6..643707f75 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/cold_partition_label.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/cold_partition_label.c @@ -35,4 +35,6 @@ main (int argc, char *argv[]) return 0; } +/* { dg-final-use { scan-assembler "foo\[._\]+cold\[\._\]+0" } } */ +/* { dg-final-use { scan-assembler "size\[ \ta-zA-Z0-0\]+foo\[._\]+cold\[\._\]+0" } } */ /* { dg-final-use { cleanup-saved-temps } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/cold_partition_patch.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/cold_partition_patch.c new file mode 100644 index 000000000..fe86963b7 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/cold_partition_patch.c @@ -0,0 +1,37 @@ +/* Check if patching works with function splitting. */ +/* { dg-require-effective-target freorder } */ +/* { dg-options "-O2 -freorder-blocks-and-partition -save-temps " { target { ! x86_64-*-* } } } +/* { dg-options "-O2 -freorder-blocks-and-partition -save-temps -mpatch-functions-for-instrumentation -fno-optimize-sibling-calls " { target x86_64-*-* } } */ +#define SIZE 10000 + +const char *sarr[SIZE]; +const char *buf_hot; +const char *buf_cold; + +__attribute__((noinline)) +void +foo (int path) +{ + int i; + if (path) + { + for (i = 0; i < SIZE; i++) + sarr[i] = buf_hot; + } + else + { + for (i = 0; i < SIZE; i++) + sarr[i] = buf_cold; + } +} + +int +main (int argc, char *argv[]) +{ + buf_hot = "hello"; + buf_cold = "world"; + foo (argc); + return 0; +} + +/* { dg-final-use { cleanup-saved-temps } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/ic-misattribution-1_0.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/ic-misattribution-1_0.c index ff103a8c5..a5aeffb17 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/ic-misattribution-1_0.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/ic-misattribution-1_0.c @@ -1,4 +1,4 @@ -/* { dg-options "-O2 -fdump-ipa-profile" } */ +/* { dg-options "-O2 -fdump-ipa-profile --param=lipo-sampling-period=1" } */ extern void callee (void); extern void caller (void (*func) (void)); diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/indir-call-prof-single_0.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/indir-call-prof-single_0.c index 29a216c69..8d78bb589 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/indir-call-prof-single_0.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/indir-call-prof-single_0.c @@ -1,4 +1,4 @@ -/* { dg-options "-O2 -fdump-tree-optimized -fdump-ipa-profile" } */ +/* { dg-options "-O2 -fdump-tree-optimized -fdump-ipa-profile --param=lipo-sampling-period=1" } */ static int a1 (void) { diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/indir-call-prof_0.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/indir-call-prof_0.c index 6bd048df6..3b681b2e5 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/indir-call-prof_0.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/indir-call-prof_0.c @@ -1,4 +1,4 @@ -/* { dg-options "-O2 -fdump-tree-optimized -fdump-ipa-profile" } */ +/* { dg-options "-O2 -fdump-tree-optimized -fdump-ipa-profile --param=lipo-sampling-period=3" } */ extern void setp (int (**pp) (void), int i); diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/time-profiler-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/time-profiler-1.c index c61b534a2..b61045b5e 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/time-profiler-1.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/time-profiler-1.c @@ -1,4 +1,4 @@ -/* { dg-options "-O2 -fdump-ipa-profile" } */ +/* { dg-options "-O2 -fdump-ipa-profile --param=profile-values-time=1" } */ __attribute__ ((noinline)) int foo() diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/time-profiler-2.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/time-profiler-2.c index 041134197..2f65d4e43 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/time-profiler-2.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/time-profiler-2.c @@ -1,4 +1,4 @@ -/* { dg-options "-O2 -fdump-ipa-profile" } */ +/* { dg-options "-O2 -fdump-ipa-profile --param=profile-values-time=1" } */ #include <unistd.h> diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/loop-19.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/loop-19.c index 74b60a054..49163c243 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/loop-19.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/loop-19.c @@ -4,7 +4,7 @@ The testcase comes from PR 29256 (and originally, the stream benchmark). */ -/* { dg-do compile { target { i?86-*-* || { x86_64-*-* || powerpc_hard_double } } } } */ +/* { dg-do compile { target { i?86-*-* || { x86_64-*-* || { powerpc_hard_double && { ! powerpc_fprs } } } } } } */ /* { dg-require-effective-target nonpic } */ /* { dg-options "-O3 -fno-tree-loop-distribute-patterns -fno-prefetch-loop-arrays -fdump-tree-optimized -fno-common" } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/pr61144.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/pr61144.c new file mode 100644 index 000000000..cd34b144e --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/pr61144.c @@ -0,0 +1,7 @@ +/* { dg-do compile } */ +/* { dg-require-weak "" } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ +static int dummy = 0; +extern int foo __attribute__((__weak__, __alias__("dummy"))); +int bar() { if (foo) return 1; return 0; } +/* { dg-final { scan-tree-dump-not "return 0" "optimized"} } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr25413a.c b/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr25413a.c index b9bef5f5b..db642812d 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr25413a.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr25413a.c @@ -102,6 +102,7 @@ octfapg_alloc (const var_t n) return m; } +__attribute__((noinline)) oct_t* octfapg_universe (const var_t n) { diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr59594.c b/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr59594.c index 6c0b5880e..14a86ed2d 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr59594.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr59594.c @@ -3,7 +3,7 @@ #include "tree-vect.h" #define N 1024 -int b[N + 1]; +int b[N + 2]; int main () diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr60196-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr60196-1.c new file mode 100644 index 000000000..10ed4afeb --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr60196-1.c @@ -0,0 +1,34 @@ +/* PR tree-optimization/63189 */ +/* { dg-additional-options "-fwrapv" } */ +/* { dg-do run } */ + +#include "tree-vect.h" + +__attribute__((noinline, noclone)) static int +bar (const short *a, int len) +{ + int x; + int x1 = 0; + + for (x = 0; x < len; x++) + x1 += x * a[x]; + return x1; +} + +__attribute__((noinline, noclone)) void +foo (void) +{ + short stuff[9] = {1, 1, 1, 1, 1, 1, 1, 1, 1 }; + if (bar (stuff, 9) != 36) + abort (); +} + +int +main () +{ + check_vect (); + foo (); + return 0; +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr60196-2.c b/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr60196-2.c new file mode 100644 index 000000000..b2059c20c --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr60196-2.c @@ -0,0 +1,33 @@ +/* PR tree-optimization/63189 */ +/* { dg-do run } */ + +#include "tree-vect.h" + +static const short a[8] = {1, 1, 1, 1, 1, 1, 1, 1 }; +static const unsigned char b[8] = {0, 0, 0, 0, 0, 0, 0, 0 }; + +__attribute__((noinline, noclone)) static int +bar (void) +{ + int sum = 0, i; + for (i = 0; i < 8; ++i) + sum += a[i] * b[i]; + return sum; +} + +__attribute__((noinline, noclone)) void +foo (void) +{ + if (bar () != 0) + abort (); +} + +int +main () +{ + check_vect (); + foo (); + return 0; +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr62021.c b/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr62021.c new file mode 100644 index 000000000..e0208e63b --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr62021.c @@ -0,0 +1,30 @@ +/* { dg-require-effective-target vect_simd_clones } */ +/* { dg-additional-options "-fopenmp-simd" } */ +/* { dg-additional-options "-mavx" { target avx_runtime } } */ + +#pragma omp declare simd linear(y) +__attribute__((noinline)) int * +foo (int *x, int y) +{ + return x + y; +} + +int a[1024]; +int *b[1024] = { &a[0] }; + +int +main () +{ + int i; + for (i = 0; i < 1024; i++) + b[i] = &a[1023 - i]; + #pragma omp simd + for (i = 0; i < 1024; i++) + b[i] = foo (b[i], i); + for (i = 0; i < 1024; i++) + if (b[i] != &a[1023]) + __builtin_abort (); + return 0; +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr62075.c b/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr62075.c new file mode 100644 index 000000000..798490e87 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr62075.c @@ -0,0 +1,22 @@ +/* { dg-do compile } */ + +int a[16][2]; +struct A +{ + int b[16][2]; + int c[16][1]; +}; + +void +foo (struct A *x) +{ + int i; + for (i = 0; i < 16; ++i) + { + x->b[i][0] = a[i][0]; + x->c[i][0] = 0 != a[i][0]; + x->b[i][1] = a[i][1]; + } +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr63189.c b/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr63189.c new file mode 100644 index 000000000..da6fba4b1 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr63189.c @@ -0,0 +1,26 @@ +/* PR tree-optimization/63189 */ +/* { dg-do run } */ + +#include "tree-vect.h" + +short int d[16] = { 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 }; + +__attribute__((noinline, noclone)) void +foo (void) +{ + int j, s = 0; + for (j = 0; j < 8; j++) + s += d[j] * j; + if (s != 7) + abort (); +} + +int +main () +{ + check_vect (); + foo (); + return 0; +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr63379.c b/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr63379.c new file mode 100644 index 000000000..f6e8fc6a4 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr63379.c @@ -0,0 +1,43 @@ +/* PR tree-optimization/63379 */ +/* { dg-do run } */ + +#include "tree-vect.h" + +extern void abort (void); + +typedef struct { + int x; + int y; +} Point; + +Point pt_array[25]; + +void __attribute__((noinline,noclone)) +generate_array(void) +{ + unsigned int i; + for (i = 0; i<25; i++) + { + pt_array[i].x = i; + pt_array[i].y = 1000+i; + } +} + +int main() +{ + check_vect (); + generate_array (); + Point min_pt = pt_array[0]; + Point *ptr, *ptr_end; + for (ptr = pt_array+1, ptr_end = pt_array+25; ptr != ptr_end; ++ptr) + { + min_pt.x = (min_pt.x < ptr->x) ? min_pt.x : ptr->x; + min_pt.y = (min_pt.y < ptr->y) ? min_pt.y : ptr->y; + } + + if (min_pt.x != 0 || min_pt.y != 1000) + abort (); + return 0; +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr63605.c b/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr63605.c new file mode 100644 index 000000000..5096c7239 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr63605.c @@ -0,0 +1,22 @@ +/* { dg-do run } */ + +#include "tree-vect.h" + +extern void abort (void); + +int a, b[8] = { 2, 0, 0, 0, 0, 0, 0, 0 }, c[8]; + +int +main () +{ + int d; + check_vect (); + for (; a < 8; a++) + { + d = b[a] >> 1; + c[a] = d != 0; + } + if (c[0] != 1) + abort (); + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/vect/vect-109.c b/gcc-4.9/gcc/testsuite/gcc.dg/vect/vect-109.c index 854c9707a..6b5db9026 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/vect/vect-109.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/vect/vect-109.c @@ -39,6 +39,7 @@ int main1 (int n) return 0; } +__attribute__ ((noinline)) int main2 (int n) { int i; diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/vmx/3c-01a.c b/gcc-4.9/gcc/testsuite/gcc.dg/vmx/3c-01a.c index 2499ca665..56f3c8708 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/vmx/3c-01a.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/vmx/3c-01a.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-options "-maltivec -mabi=altivec -std=gnu99 -mno-vsx -Wno-deprecated" } */ #include <altivec.h> typedef const volatile unsigned int _1; typedef const unsigned int _2; diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/vmx/ops-long-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/vmx/ops-long-1.c index 547170679..bceb4fc8d 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/vmx/ops-long-1.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/vmx/ops-long-1.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-options "-maltivec -mabi=altivec -std=gnu99 -mno-vsx -Wno-deprecated" } */ /* Checks from the original ops.c that pass pointers to long or unsigned long for operations that support that in released versions diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/vmx/ops.c b/gcc-4.9/gcc/testsuite/gcc.dg/vmx/ops.c index b39ad1d65..21801ca23 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/vmx/ops.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/vmx/ops.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-options "-maltivec -mabi=altivec -std=gnu99 -mno-vsx -Wno-deprecated" } */ #include <altivec.h> #include <stdlib.h> extern char * *var_char_ptr; |