diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg')
| -rw-r--r-- | gcc/testsuite/gcc.dg/pid_t-1.c | 19 | ||||
| -rw-r--r-- | gcc/testsuite/gcc.dg/pointer-counted-by-pr122982.c | 19 | ||||
| -rw-r--r-- | gcc/testsuite/gcc.dg/pr123018.c | 17 | ||||
| -rw-r--r-- | gcc/testsuite/gcc.dg/tls/data-sections-1.c | 14 | ||||
| -rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr123027.c | 20 | ||||
| -rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/pr46555.c | 28 | ||||
| -rw-r--r-- | gcc/testsuite/gcc.dg/vect/pr123038.c | 8 |
7 files changed, 125 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/pid_t-1.c b/gcc/testsuite/gcc.dg/pid_t-1.c new file mode 100644 index 0000000..f4f3f68 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pid_t-1.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-Wall" } */ +/* { dg-require-fork "" } */ + +/* Compile with -Wall to get a warning if built-in and system pid_t don't + match. */ + +#include <sys/types.h> + +typedef __typeof (__builtin_fork ()) __builtin_pid_t; + +__builtin_pid_t __p_t__; +pid_t *p_t_p; + +void +pt (void) +{ + p_t_p = &__p_t__; +} diff --git a/gcc/testsuite/gcc.dg/pointer-counted-by-pr122982.c b/gcc/testsuite/gcc.dg/pointer-counted-by-pr122982.c new file mode 100644 index 0000000..1bad7f0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pointer-counted-by-pr122982.c @@ -0,0 +1,19 @@ +/* PR c/122982 */ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +int* f (int); + +struct __bounded_ptr { + int k; + int *buf __attribute__ ((counted_by (k))); +}; + +int* +f1 (int n) { return f (n); } + +void h1 (void) +{ + int *p = (struct __bounded_ptr) {3, f1 (3)}.buf; + __builtin_memset (p, 0, 3 * sizeof p); +} diff --git a/gcc/testsuite/gcc.dg/pr123018.c b/gcc/testsuite/gcc.dg/pr123018.c new file mode 100644 index 0000000..f1f701b --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr123018.c @@ -0,0 +1,17 @@ +/* PR c/123018 */ +/* { dg-do compile } */ + +struct A { + int x : 8 __attribute__ ((vector_size (8))); /* { dg-error "bit-field 'x' has invalid type" } */ +}; +struct B { + float x : 8; /* { dg-error "bit-field 'x' has invalid type" } */ +}; +struct C { + int : 8 __attribute__ ((vector_size (8))); /* { dg-error "bit-field '\[^\n\r]*anonymous\[^\n\r]*' has invalid type" } */ + int x; +}; +struct D { + float : 8; /* { dg-error "bit-field '\[^\n\r]*anonymous\[^\n\r]*' has invalid type" } */ + int x; +}; diff --git a/gcc/testsuite/gcc.dg/tls/data-sections-1.c b/gcc/testsuite/gcc.dg/tls/data-sections-1.c new file mode 100644 index 0000000..c829256 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tls/data-sections-1.c @@ -0,0 +1,14 @@ +/* { dg-do run } */ +/* { dg-require-effective-target tls_runtime } */ +/* { dg-options "-fdata-sections" } */ +/* { dg-add-options tls } */ + +__thread int i = 1; + +int main (void) +{ + if (i != 1) + __builtin_abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr123027.c b/gcc/testsuite/gcc.dg/torture/pr123027.c new file mode 100644 index 0000000..cba4cc9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr123027.c @@ -0,0 +1,20 @@ +/* { dg-do run } */ +/* { dg-options "-ffinite-math-only" } */ +/* { dg-add-options ieee } */ + +double a = 0.0; +double b = -0.0; + +int main() +{ + double min1 = a < b ? a : b; + double max1 = a > b ? a : b; + double min2 = b < a ? b : a; + double max2 = b > a ? b : a; + if (__builtin_copysign (1., min1) != -1. + || __builtin_copysign (1., max1) != -1. + || __builtin_copysign (1., min2) != 1. + || __builtin_copysign (1., max2) != 1.) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr46555.c b/gcc/testsuite/gcc.dg/tree-ssa/pr46555.c new file mode 100644 index 0000000..d4de7c2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr46555.c @@ -0,0 +1,28 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized-details -fdump-rtl-pro_and_epilogue" } */ +/* PR tree-optimization/46555 */ +/* Here should not remove the forwarder block (or rather recreate it and not + remove it again). This improves expansion to RTL as there is one less copy + (or constant formation) in some cases. In this case we also get the ability + to shrink wrap the function. */ + +int h(void); +int f(int a, int b, int c) +{ + if (a) + return 2; + h(); + if (b) + return 2; + h(); + if (c) + return 2; + h(); + return 4; +} + +/* { dg-final { scan-tree-dump-times "New forwarder block for edge" 1 "optimized" } } */ +/* Make sure we only have a PHI with 2 arguments here, 2 and 4. */ +/* { dg-final { scan-tree-dump "PHI <2..., 4...>|PHI <4..., 2...>" "optimized" } } */ +/* Make sure we can shrink wrap the function now too. */ +/* { dg-final { scan-rtl-dump "Performing shrink-wrapping" "pro_and_epilogue" { target { { { i?86-*-* x86_64-*-* } && { ! ia32 } } || { powerpc*-*-* aarch64*-*-* riscv*-*-* arm*-*-* } } } } } */ diff --git a/gcc/testsuite/gcc.dg/vect/pr123038.c b/gcc/testsuite/gcc.dg/vect/pr123038.c new file mode 100644 index 0000000..bca831f --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr123038.c @@ -0,0 +1,8 @@ +/* { dg-do compile } */ + +unsigned char f(int b) +{ + for (int a = 0; a < 10; a += 1) + b = __builtin_ffs(b); + return b; +} |
