diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg')
33 files changed, 668 insertions, 17 deletions
diff --git a/gcc/testsuite/gcc.dg/atomic/stdatomic-flag.c b/gcc/testsuite/gcc.dg/atomic/stdatomic-flag.c index 32f9e9bb631..c1a63f1b3aa 100644 --- a/gcc/testsuite/gcc.dg/atomic/stdatomic-flag.c +++ b/gcc/testsuite/gcc.dg/atomic/stdatomic-flag.c @@ -1,5 +1,5 @@ /* Test atomic_flag routines for existence and execution. */ -/* { dg-do run } */ +/* { dg-do run { xfail hppa*-*-hpux* } } */ /* { dg-options "-std=c11 -pedantic-errors" } */ #include <stdatomic.h> diff --git a/gcc/testsuite/gcc.dg/builtin-bswap-6.c b/gcc/testsuite/gcc.dg/builtin-bswap-6.c index 024ebf1edf6..efda8706e63 100644 --- a/gcc/testsuite/gcc.dg/builtin-bswap-6.c +++ b/gcc/testsuite/gcc.dg/builtin-bswap-6.c @@ -1,7 +1,10 @@ /* { dg-do compile { target arm*-*-* alpha*-*-* i?86-*-* powerpc*-*-* rs6000-*-* x86_64-*-* s390*-*-* } } */ /* { dg-require-effective-target stdint_types } */ /* { dg-options "-O -fdump-rtl-combine" } */ -/* { dg-options "-O -fdump-rtl-combine -march=z900" { target s390-*-* } } */ + +/* The branch cost setting prevents the return value from being + calculated with arithmetic instead of doing a compare. */ +/* { dg-additional-options "-march=z900 -mbranch-cost=0" { target s390*-*-* } } */ #include <stdint.h> diff --git a/gcc/testsuite/gcc.dg/builtin-bswap-6a.c b/gcc/testsuite/gcc.dg/builtin-bswap-6a.c new file mode 100644 index 00000000000..f93bcde1027 --- /dev/null +++ b/gcc/testsuite/gcc.dg/builtin-bswap-6a.c @@ -0,0 +1,44 @@ +/* { dg-do compile { target arm*-*-* alpha*-*-* i?86-*-* powerpc*-*-* rs6000-*-* x86_64-*-* s390*-*-* } } */ +/* { dg-require-effective-target stdint_types } */ +/* { dg-options "-O2 -fdump-rtl-combine" } */ +/* { dg-additional-options "-march=z900" { target s390-*-* } } */ + +/* The test is similiar to builtin-bswap-6.c but returns 1/2 instead + of 0/1 to prevent GCC from calculating the return value with + arithmetic instead of a comparison. This requires the optimization + level to be bumped up to -O2 at least for x86_64. */ + +#include <stdint.h> + +#define BS(X) __builtin_bswap32(X) + +int foo1 (uint32_t a) +{ + if (BS (a) == 0xA0000) + return 1; + return 2; +} + +int foo2 (uint32_t a) +{ + if (BS (a) != 0xA0000) + return 1; + return 2; +} + +int foo3 (uint32_t a, uint32_t b) +{ + if (BS (a) == BS (b)) + return 1; + return 2; +} + +int foo4 (uint32_t a, uint32_t b) +{ + if (BS (a) != BS (b)) + return 1; + return 2; +} + +/* { dg-final { scan-rtl-dump-not "bswapsi" "combine" } } */ +/* { dg-final { cleanup-rtl-dump "combine" } } */ diff --git a/gcc/testsuite/gcc.dg/builtin-bswap-7.c b/gcc/testsuite/gcc.dg/builtin-bswap-7.c index 399b825ac43..035c7368ad0 100644 --- a/gcc/testsuite/gcc.dg/builtin-bswap-7.c +++ b/gcc/testsuite/gcc.dg/builtin-bswap-7.c @@ -3,6 +3,10 @@ /* { dg-require-effective-target lp64 } */ /* { dg-options "-O -fdump-rtl-combine" } */ +/* The branch cost setting prevents the return value from being + calculated with arithmetic instead of doing a compare. */ +/* { dg-additional-options "-mbranch-cost=0" { target s390x-*-* } } */ + #include <stdint.h> #define BS(X) __builtin_bswap64(X) diff --git a/gcc/testsuite/gcc.dg/builtin-bswap-7a.c b/gcc/testsuite/gcc.dg/builtin-bswap-7a.c new file mode 100644 index 00000000000..d77bd478366 --- /dev/null +++ b/gcc/testsuite/gcc.dg/builtin-bswap-7a.c @@ -0,0 +1,44 @@ +/* { dg-do compile { target arm*-*-* alpha*-*-* ia64*-*-* x86_64-*-* s390x-*-* powerpc*-*-* rs6000-*-* } } */ +/* { dg-require-effective-target stdint_types } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-options "-O2 -fdump-rtl-combine" } */ + +/* The test is similiar to builtin-bswap-7.c but returns 1/2 instead + of 0/1 to prevent GCC from calculating the return value with + arithmetic instead of a comparison. This requires the optimization + level to be bumped up to -O2 at least for x86_64. */ + +#include <stdint.h> + +#define BS(X) __builtin_bswap64(X) + +int foo1 (uint64_t a) +{ + if (BS (a) == 0xA00000000) + return 1; + return 2; +} + +int foo2 (uint64_t a) +{ + if (BS (a) != 0xA00000000) + return 1; + return 2; +} + +int foo3 (uint64_t a, uint64_t b) +{ + if (BS (a) == BS (b)) + return 1; + return 2; +} + +int foo4 (uint64_t a, uint64_t b) +{ + if (BS (a) != BS (b)) + return 1; + return 2; +} + +/* { dg-final { scan-rtl-dump-not "bswapdi" "combine" } } */ +/* { dg-final { cleanup-rtl-dump "combine" } } */ diff --git a/gcc/testsuite/gcc.dg/format/warn-signedness.c b/gcc/testsuite/gcc.dg/format/warn-signedness.c new file mode 100644 index 00000000000..473d522c8a6 --- /dev/null +++ b/gcc/testsuite/gcc.dg/format/warn-signedness.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-Wformat -Wformat-signedness" } */ + +/* PR c/60194 */ + +void foo(unsigned u, int i, unsigned char uc, signed char sc) { + __builtin_printf("%d\n", u); /* { dg-warning "expects argument of type 'int', but argument 2 has type 'unsigned int'" } */ + __builtin_printf("%u\n", i); /* { dg-warning "expects argument of type 'unsigned int', but argument 2 has type 'int'" } */ + __builtin_printf("%c\n", sc); + __builtin_printf("%c\n", uc); +} diff --git a/gcc/testsuite/gcc.dg/graphite/pr55022.c b/gcc/testsuite/gcc.dg/graphite/pr55022.c new file mode 100644 index 00000000000..c631c0e23e6 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/pr55022.c @@ -0,0 +1,27 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -fgraphite-identity" } */ + +extern void abort (void); + +void __attribute__((noinline,noclone)) +f(int *limit, int minLen, int maxLen) +{ + int i; + + for (i = minLen; i <= maxLen; i++) { + limit[i] = i; + } +} + +int main() +{ + int limit[256], i; + f (limit, 0, 255); + for (i = 0; i < 256; ++i) + { + if (limit[i] != i) + abort (); + __asm__ volatile ("" : : : "memory"); + } + return 0; +} diff --git a/gcc/testsuite/gcc.dg/graphite/pr59817-1.c b/gcc/testsuite/gcc.dg/graphite/pr59817-1.c new file mode 100644 index 00000000000..175fa16fd71 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/pr59817-1.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -floop-interchange" } */ + +int kd; + +void +n2(void) +{ + static int so; + static short int i5; + int wj; + int *il; + int *nk = &so; + for (wj = 0; wj < 2; ++wj) + *nk = ((i5 += *il) || kd ); +} diff --git a/gcc/testsuite/gcc.dg/graphite/pr59817-2.c b/gcc/testsuite/gcc.dg/graphite/pr59817-2.c new file mode 100644 index 00000000000..13950076814 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/pr59817-2.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -floop-interchange" } */ + +void +xl(void) +{ + static int j3; + for (j3 = 0; j3 < 1; ++j3) { + static int f2; + static int w7; + short int b5; + int ok; + f2 = (b5 += ok) ? (w7 = 0): (w7 ? 0 : (f2 = ok)); + } +} diff --git a/gcc/testsuite/gcc.dg/graphite/pr60740.c b/gcc/testsuite/gcc.dg/graphite/pr60740.c new file mode 100644 index 00000000000..5b7c1802236 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/pr60740.c @@ -0,0 +1,16 @@ +/* { dg-options "-O2 -floop-interchange" } */ + +int **db6 = 0; + +void +k26(void) +{ + static int geb = 0; + int *a22 = &geb; + int **l30 = &a22; + int *c4b; + int ndf; + for (ndf = 0; ndf <= 1; ++ndf) + *c4b = (db6 == l30) && (*a22)--; +} + diff --git a/gcc/testsuite/gcc.dg/graphite/pr60785.c b/gcc/testsuite/gcc.dg/graphite/pr60785.c new file mode 100644 index 00000000000..87c1c685b0a --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/pr60785.c @@ -0,0 +1,27 @@ +/* { dg-options "-O2 -floop-interchange" } */ + +static int +aqc(void) +{ + return 1; +} + +void +gkd(void) +{ + int wu0; + static int b1y; + static int gw2; + static int *ydw = &gw2; + static int **m3l = &ydw; + **m3l = 0; + for (b1y = 0; b1y < 1; ++b1y) + { + int *cpj = &gw2; + if (*ydw |= aqc()) + { + *cpj = 0; + *ydw = wu0; + } + } +} diff --git a/gcc/testsuite/gcc.dg/lto/pr55113_0.c b/gcc/testsuite/gcc.dg/lto/pr55113_0.c index 0477fe41bc8..8c309761bce 100644 --- a/gcc/testsuite/gcc.dg/lto/pr55113_0.c +++ b/gcc/testsuite/gcc.dg/lto/pr55113_0.c @@ -2,6 +2,7 @@ /* { dg-lto-do link } */ /* { dg-lto-options { { -flto -fshort-double -O0 } } }*/ /* { dg-skip-if "PR60410" { x86_64-*-* || { i?86-*-* && lp64 } } } */ +/* { dg-skip-if "PR60410" { i?86-*-solaris2.1[0-9]* } } */ int main(void) diff --git a/gcc/testsuite/gcc.dg/lto/pr59626_0.c b/gcc/testsuite/gcc.dg/lto/pr59626_0.c new file mode 100644 index 00000000000..752982fb506 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/pr59626_0.c @@ -0,0 +1,15 @@ +/* { dg-lto-do run } */ + +int __atoi (const char *) __asm__("atoi"); +extern inline __attribute__((always_inline,gnu_inline)) +int atoi (const char *x) +{ + return __atoi (x); +} + +int bar (int (*)(const char *)); + +int main() +{ + return bar (atoi); +} diff --git a/gcc/testsuite/gcc.dg/lto/pr59626_1.c b/gcc/testsuite/gcc.dg/lto/pr59626_1.c new file mode 100644 index 00000000000..9b3fa1d2e36 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/pr59626_1.c @@ -0,0 +1,4 @@ +int bar (int (*fn)(const char *)) +{ + return fn ("0"); +} diff --git a/gcc/testsuite/gcc.dg/lto/pr60720_0.c b/gcc/testsuite/gcc.dg/lto/pr60720_0.c new file mode 100644 index 00000000000..79cef5dad1a --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/pr60720_0.c @@ -0,0 +1,15 @@ +/* { dg-lto-do run } */ +/* { dg-extra-ld-options { -w } } */ + +/* ??? lto.exp does not allow to scan for + :1:12: warning: type of 'x' does not match original declaration + extern int x[]; + ^ + :1:5: note: previously declared here + int x; + ^ */ + +extern int x[]; +int *foo[] = { &x[0] }; + +int main() { return *foo[0]; } diff --git a/gcc/testsuite/gcc.dg/lto/pr60720_1.c b/gcc/testsuite/gcc.dg/lto/pr60720_1.c new file mode 100644 index 00000000000..6d1a0d47b7f --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/pr60720_1.c @@ -0,0 +1 @@ +int x; diff --git a/gcc/testsuite/gcc.dg/lto/pr60820_0.c b/gcc/testsuite/gcc.dg/lto/pr60820_0.c new file mode 100644 index 00000000000..349cf6a02f1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/pr60820_0.c @@ -0,0 +1,13 @@ +/* { dg-lto-do link } */ +/* { dg-lto-options {{-flto -r -nostdlib -O2}} } */ +#include <stdio.h> +struct in6_addr {int bah;}; +extern const struct in6_addr in6addr_any; +static const struct in6_addr local_in6addr_any = {1}; +#pragma weak in6addr_any = local_in6addr_any + +__attribute__ ((used)) +void foo2() +{ + fprintf (stderr, "v1: %p, v2: %p\n", &local_in6addr_any, &in6addr_any); +} diff --git a/gcc/testsuite/gcc.dg/lto/pr60820_1.c b/gcc/testsuite/gcc.dg/lto/pr60820_1.c new file mode 100644 index 00000000000..16009e424f8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/pr60820_1.c @@ -0,0 +1,11 @@ +#include <stdio.h> +struct in6_addr {int bah;}; +extern const struct in6_addr in6addr_any; +static const struct in6_addr local_in6addr_any = {1}; +#pragma weak in6addr_any = local_in6addr_any + +__attribute__ ((used)) +void foo() +{ + fprintf (stderr, "v1: %p, v2: %p\n", &local_in6addr_any, &in6addr_any); +} diff --git a/gcc/testsuite/gcc.dg/pr60797.c b/gcc/testsuite/gcc.dg/pr60797.c new file mode 100644 index 00000000000..45090bae502 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr60797.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-skip-if "" { alias } } */ + +extern int foo __attribute__((alias("bar"))); /* { dg-error "supported" } */ +int main() +{ + return 0; +} diff --git a/gcc/testsuite/gcc.dg/pr60844.c b/gcc/testsuite/gcc.dg/pr60844.c new file mode 100644 index 00000000000..16ed243d74c --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr60844.c @@ -0,0 +1,16 @@ +/* PR tree-optimization/60844 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -g" } */ +/* { dg-additional-options "-mtune=atom" { target { i?86-*-* x86_64-*-* } } } */ + +void +foo (int *x, int y, int z) +{ + int b, c = x[0], d = x[1]; + for (b = 0; b < 1; b++) + { + int e = (y ? 1 : 0) | (d ? 2 : 0) | (z ? 1 : 0); + e |= (c ? 2 : 0) | ((1 >> b) ? 1 : 0); + x[2 + b] = e; + } +} diff --git a/gcc/testsuite/gcc.dg/torture/pr56965-1.c b/gcc/testsuite/gcc.dg/torture/pr56965-1.c new file mode 100644 index 00000000000..2512db3965d --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr56965-1.c @@ -0,0 +1,32 @@ +/* { dg-do run } */ +/* { dg-options "-fschedule-insns" { target scheduling } } */ + +extern void abort (void); + +struct S { + int i; + int j; +}; + +struct U { + struct S s; +} __attribute__((may_alias)); + +int __attribute__((noinline,noclone)) +foo (struct U *p, struct U *q) +{ + int i; + q->s.j = 1; + i = p->s.i; + return i; +} + +int main() +{ + int a[3]; + int *p = a; + p[1] = 0; + if (foo ((struct U *)(p + 1), (struct U *)p) != 1) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr56965-2.c b/gcc/testsuite/gcc.dg/torture/pr56965-2.c new file mode 100644 index 00000000000..04f55914e9c --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr56965-2.c @@ -0,0 +1,34 @@ +extern void abort (void); + +struct S { int i; int j; }; +struct X { struct S s; int k; }; +struct Y { int k; struct S s; }; +union U { struct X x; struct Y y; } __attribute__((may_alias)); + +int __attribute__((noinline)) +foo (union U *p, union U *q) +{ + p->x.s.j = 1; + q->y.s.i = 0; + return p->x.s.j; +} + +struct R { int i; int j; } __attribute__((may_alias)); + +int __attribute__((noinline)) +bar (struct R *p, struct R *q) +{ + p->i = 1; + q->j = 0; + return p->i; +} + +int main() +{ + int a[3]; + if (foo ((union U *)&a[0], (union U *)&a[0]) != 0) + abort (); + if (bar ((struct R *)&a[1], (struct R *)&a[0]) != 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr60733.c b/gcc/testsuite/gcc.dg/torture/pr60733.c new file mode 100644 index 00000000000..49cc59ea33a --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr60733.c @@ -0,0 +1,36 @@ +/* { dg-do run } */ + +int a, d, e, f, g, h, i, j, k; +unsigned short b; + +short +fn1 (int p1, int p2) +{ + return p1 * p2; +} + +int +main () +{ + for (; a; a--) + { + int l = 0; + if (f >= 0) + { + for (; h;) + e = 0; + for (; l != -6; l--) + { + j = fn1 (b--, d); + for (g = 0; g; g = 1) + ; + k = e ? 2 : 0; + } + i = 0; + for (;;) + ; + } + } + d = 0; + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr60766.c b/gcc/testsuite/gcc.dg/torture/pr60766.c new file mode 100644 index 00000000000..6f16e3b7408 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr60766.c @@ -0,0 +1,15 @@ +/* { dg-do run } */ + +int m = 9; + +int main() +{ + int n, x; + + n = m; + for (x = 0; x <= n; x++) + if (n == x + (x + 1) + (x + 2)) + return 0; + + __builtin_abort(); +} diff --git a/gcc/testsuite/gcc.dg/tree-prof/update-loopch.c b/gcc/testsuite/gcc.dg/tree-prof/update-loopch.c index 5297098fc91..85a4b2a840c 100644 --- a/gcc/testsuite/gcc.dg/tree-prof/update-loopch.c +++ b/gcc/testsuite/gcc.dg/tree-prof/update-loopch.c @@ -15,8 +15,9 @@ main () is once reached directly from entry point of function, rest via loopback edge. */ /* { dg-final-use { scan-ipa-dump "loop depth 1, count 33334" "profile"} } */ -/* { dg-final-use { scan-tree-dump "loop depth 1, count 33332" "optimized"} } */ -/* { dg-final-use { scan-tree-dump-times "Removing basic block \[^\r\n\]*\[\\r\\n\]+\[^\r\n\]*\[\\r\\n\]+Invalid sum of\[^\r\n\]*\[\\r\\n\]+Invalid sum of" 1 "optimized"} } */ -/* { dg-final-use { scan-tree-dump-times "Invalid sum of" 2 "optimized"} } */ +/* { dg-final-use { scan-tree-dump "loop depth 1, count 33333" "optimized"} } */ +/* { dg-final-use { scan-tree-dump-not "loop depth 1, count 33332" "optimized"} } */ +/* { dg-final-use { scan-tree-dump "Removing basic block" "optimized"} } */ +/* { dg-final-use { scan-tree-dump-not "Invalid sum" "optimized"} } */ /* { dg-final-use { cleanup-ipa-dump "profile" } } */ /* { dg-final-use { cleanup-tree-dump "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/20040517-1.c b/gcc/testsuite/gcc.dg/tree-ssa/20040517-1.c index 99b27ce02f1..b49cf648c7d 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/20040517-1.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/20040517-1.c @@ -16,6 +16,7 @@ void bar (void) /* We used to treat malloc functions like pure and const functions, but malloc functions may clobber global memory. Only the function result does not alias any other pointer. - Hence, we must have a VDEF for a before and after the call to foo(). */ -/* { dg-final { scan-tree-dump-times "VDEF" 2 "alias"} } */ + Hence, we must have a VDEF for a before and after the call to foo(). + And one after the call to abort(). */ +/* { dg-final { scan-tree-dump-times "VDEF" 3 "alias"} } */ /* { dg-final { cleanup-tree-dump "alias" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-13.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-13.c index 19f892eaa85..43b92c11569 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-13.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-13.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O1 -fdump-tree-optimized" } */ -/* { dg-additional-options "-mbranch-cost=2" { target { i?86-*-* x86_64-*-* mips*-*-* s390*-*-* avr*-*-* } } } */ +/* { dg-additional-options "-mbranch-cost=2" { target { i?86-*-* x86_64-*-* s390*-*-* avr*-*-* } } } */ _Bool f1(_Bool a, _Bool b) { @@ -17,5 +17,5 @@ _Bool f1(_Bool a, _Bool b) /* For LOGICAL_OP_NON_SHORT_CIRCUIT, this should be optimized into return a & b;, with no ifs. */ -/* { dg-final { scan-tree-dump-not "if" "optimized" { target { i?86-*-* x86_64-*-* mips*-*-* s390*-*-* avr*-*-* } } } } */ +/* { dg-final { scan-tree-dump-not "if" "optimized" { target { i?86-*-* x86_64-*-* s390*-*-* avr*-*-* } } } } */ /* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/uninit-B-O0.c b/gcc/testsuite/gcc.dg/uninit-B-O0.c index e2883a38ea8..5557ace6f8d 100644 --- a/gcc/testsuite/gcc.dg/uninit-B-O0.c +++ b/gcc/testsuite/gcc.dg/uninit-B-O0.c @@ -9,7 +9,7 @@ void baz (void) { int i; - if (i) /* { dg-warning "uninit" "uninit i warning" { xfail *-*-* } } */ + if (i) /* { dg-warning "'i' is used uninitialized in this function" } */ bar (i); foo (&i); } diff --git a/gcc/testsuite/gcc.dg/uninit-I-O0.c b/gcc/testsuite/gcc.dg/uninit-I-O0.c index 655f5489279..761f65b485b 100644 --- a/gcc/testsuite/gcc.dg/uninit-I-O0.c +++ b/gcc/testsuite/gcc.dg/uninit-I-O0.c @@ -3,6 +3,6 @@ int sys_msgctl (void) { - struct { int mode; } setbuf; /* { dg-warning "'setbuf\.mode' is used" {} { xfail *-*-* } } */ - return setbuf.mode; + struct { int mode; } setbuf; + return setbuf.mode; /* { dg-warning "'setbuf\.mode' is used uninitialized in this function" } */ } diff --git a/gcc/testsuite/gcc.dg/uninit-pr19430-O0.c b/gcc/testsuite/gcc.dg/uninit-pr19430-O0.c index 4ce258653d6..63f0b2b44f3 100644 --- a/gcc/testsuite/gcc.dg/uninit-pr19430-O0.c +++ b/gcc/testsuite/gcc.dg/uninit-pr19430-O0.c @@ -16,10 +16,9 @@ foo (int i) return j; } - int foo2( void ) { - int rc; /* { dg-warning "'rc' is used uninitialized in this function" "uninitialized" { xfail *-*-* } 21 } */ - return rc; + int rc; + return rc; /* { dg-warning "'rc' is used uninitialized in this function" } */ *&rc = 0; } @@ -29,7 +28,7 @@ void frob(int *pi); int main(void) { int i; - printf("i = %d\n", i); /* { dg-warning "'i' is used uninitialized in this function" "uninitialized" { xfail *-*-* } 32 } */ + printf("i = %d\n", i); /* { dg-warning "'i' is used uninitialized in this function" } */ frob(&i); return 0; @@ -38,6 +37,6 @@ int main(void) void foo3(int*); void bar3(void) { int x; - if(x) /* { dg-warning "'x' is used uninitialized in this function" "uninitialized" { xfail *-*-* } 41 } */ + if(x) /* { dg-warning "'x' is used uninitialized in this function" } */ foo3(&x); } diff --git a/gcc/testsuite/gcc.dg/vect/pr60505.c b/gcc/testsuite/gcc.dg/vect/pr60505.c new file mode 100644 index 00000000000..694051320ce --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr60505.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-Wall -Werror" } */ + +void foo(char *in, char *out, int num) +{ + int i; + char ovec[16] = {0}; + + for(i = 0; i < num ; ++i) + out[i] = (ovec[i] = in[i]); + out[num] = ovec[num/2]; +} diff --git a/gcc/testsuite/gcc.dg/vect/pr60656.c b/gcc/testsuite/gcc.dg/vect/pr60656.c new file mode 100644 index 00000000000..4950275fb87 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr60656.c @@ -0,0 +1,47 @@ +/* { dg-require-effective-target vect_int } */ +/* { dg-require-effective-target vect_long } */ + +#include "tree-vect.h" + +__attribute__ ((noinline)) long +foo () +{ + int v[] = {5000, 5001, 5002, 5003}; + long s = 0; + int i; + + for(i = 0; i < 4; ++i) + { + long P = v[i]; + s += P * P * P; + } + return s; +} + +long +bar () +{ + int v[] = {5000, 5001, 5002, 5003}; + long s = 0; + int i; + + for(i = 0; i < 4; ++i) + { + long P = v[i]; + s += P * P * P; + __asm__ volatile (""); + } + return s; +} + +int main() +{ + check_vect (); + + if (foo () != bar ()) + abort (); + return 0; +} + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_widen_mult_si_to_di_pattern } } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/pr60841.c b/gcc/testsuite/gcc.dg/vect/pr60841.c new file mode 100644 index 00000000000..44b5d019169 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr60841.c @@ -0,0 +1,183 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-ffast-math" } */ + +/* This testcase shouldn't consume much memory or produce a 1GB vectorizer + dump file due to SLP tree explosion. */ + +struct S { int f1, f2, f3, f4; } a; +struct T { short f3, f2, f1, f4; }; +int b, c, d, e, f, g; +unsigned long z; + +void +foo (struct T *p, struct T *q, int x, int w) +{ + for (; x; x++) + { + struct S h; + int i; + struct T j; + struct T *r; + h = a; + g = 0; + r = p + 2 * (c + 4) + 1; + j = *r; + r = p; + f = r->f1 - 1; + b = +1.0 + f * f; + i = (r->f2 + j.f2) / 2; + f = r->f3 - 1; + b += 1.0 - i * f * f; + f = r->f4 - 1; + if (b) + b += -1.0 - i * f; + if (b / w) + { + h.f1 += 8.0 * r->f1; + h.f2 += 8.0 * r->f2; + h.f3 += 8.0 * r->f3; + h.f4 += 8.0 * r->f4; + g = 1; + } + r++; + f = r->f1; + i = (r->f2 + j.f2) / 2; + f = r->f3 - 1; + b += 1.0 - i * f * f; + i = (r->f4); + if (b * 65535UL / w) + { + h.f1 += 10.0 * r->f1; + h.f2 += 10.0 * r->f2; + h.f3 += 10.0 * r->f3; + h.f4 += 10.0 * r->f4; + g += 10.0; + } + r++; + f = r->f1; + z = 5UL * i; + f = r->f2; + i = (r->f3 + j.f3) / 2; + b = -i * f * f; + i = (r->f4 + j.f4) / 2; + if (b * 65535UL / 25.0f) + { + h.f1 += 8.0 * r->f1; + h.f2 += 8.0 * r->f2; + h.f3 += 8.0 * r->f3; + h.f4 += 8.0 * r->f4; + g += 8.0; + } + r++; + f = r->f1 - j.f1; + b = 1 * 2.0 * i * f * f; + f = r->f2; + b += 4.0 * f; + i = r->f3 / 2; + f = r->f4 - 1; + if (b * 1) + { + h.f1 += 8.0 * r->f1; + h.f2 += 8.0 * r->f2; + h.f3 += 8.0 * r->f3; + h.f4 += 8.0 * r->f4; + g += 8.0; + } + b = 4.0 * 1 * f; + if (b * 65535UL / 25.0f) + { + h.f1 += 20.0 * r->f1; + h.f2 += 20.0 * r->f2; + h.f3 += 20.0 * r->f3; + h.f4 += 20.0 * r->f4; + g += 20.0; + } + b = 5 * (0.0 - i); + if (b < 0) + { + h.f1 += 8.0 * r->f1; + h.f2 += 8.0 * r->f2; + h.f3 += 8.0 * r->f3; + h.f4 += 8.0 * r->f4; + g += 8.0; + } + r = p + 2 * (c + 4); + i = (r->f1 + j.f1); + b = 1 * 2.0 * i * 1; + f = r->f2 - 1; + i = (r->f3 + j.f3) / 2; + b = 5 * (0.0 - i) * f * f; + i = (r->f4 + j.f4) / 2; + if (b * 65535UL / 25.0f) + { + h.f1 += 10.0 * r->f1; + h.f2 += 10.0 * r->f2; + h.f3 += 10.0 * r->f3; + h.f4 += 10.0 * r->f4; + g += 10.0; + } + r++; + f = r->f1; + b = 5UL * i * f; + i = (r->f2 + j.f2) / 2; + f = r->f3 - 1; + b = 5 * (0.0 - i) * f * f; + f = r->f4 - 1; + if (b * 65535UL / 25.0f) + { + h.f1 += 40.0 * r->f1; + h.f2 += 40.0 * r->f2; + h.f3 += 40.0 * r->f3; + h.f4 += 40.0 * r->f4; + g += 40.0; + } + r++; + i = (r->f1 + j.f1); + b = 5 * i * f; + f = r->f2; + b = 4.0 * f * f; + f = r->f3; + i = (r->f4 + j.f4) / 2; + b = 5 * (0.0 - i) * f * f; + if (b * 25.0f) + { + h.f1 += 8.0 * r->f1; + h.f2 += 8.0 * r->f2; + h.f3 += 8.0 * r->f3; + h.f4 += 8.0 * r->f4; + g += 8.0; + } + r = p + 4 * (c + 4); + i = r->f1 / 2; + b = 5 * (1.0 + i); + i = r->f2 + j.f2; + f = r->f3 - 1; + b = 5 * (0.0 - i) * f * f; + i = (r->f4 + j.f4) / 2; + if (b * 65535UL / 25.0f) + { + h.f1 += 5.0 * r->f1; + h.f2 += 5.0 * r->f2; + h.f3 += 5.0 * r->f3; + h.f4 += 5.0 * r->f4; + g += 5.0; + } + b = 5 * (1.0 + i); + if (b < 0) + { + h.f1 += 5.0 * r->f1; + h.f2 += 5.0 * r->f2; + h.f3 += 5.0 * r->f3; + h.f4 += 5.0 * r->f4; + g += 5.0; + } + q->f1 = (h.f1 + g / 2 - 1) / g; + q->f2 = (h.f2 + g / 2 - 1) / g; + q->f3 = (h.f3 + g / 2 - 1) / g; + q->f4 = (h.f4 + g / 2 - 1) / g; + p++; + q++; + } +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ |