diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg')
23 files changed, 424 insertions, 9 deletions
diff --git a/gcc/testsuite/gcc.dg/20141029-1.c b/gcc/testsuite/gcc.dg/20141029-1.c index b25af576967..1d18a1b8ac3 100644 --- a/gcc/testsuite/gcc.dg/20141029-1.c +++ b/gcc/testsuite/gcc.dg/20141029-1.c @@ -14,7 +14,7 @@ struct system_periph { unsigned short :8; } BIT; } ALL; -}; +} __attribute__((aligned(2))); void foo() diff --git a/gcc/testsuite/gcc.dg/20150306-1.c b/gcc/testsuite/gcc.dg/20150306-1.c new file mode 100644 index 00000000000..55caf3b93ce --- /dev/null +++ b/gcc/testsuite/gcc.dg/20150306-1.c @@ -0,0 +1,20 @@ +/* { dg-do run } */ +/* { dg-require-effective-target size32plus } */ +/* { dg-options "-fstrict-volatile-bitfields" } */ + +struct s +{ + char x : 8; + unsigned int y : 31; +} __attribute__((packed)); + +volatile struct s global; + +int +main () +{ + global.y = 0x7FFFFFFF; + if (global.y != 0x7FFFFFFF) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/builtin-object-size-15.c b/gcc/testsuite/gcc.dg/builtin-object-size-15.c new file mode 100644 index 00000000000..97018572bf8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/builtin-object-size-15.c @@ -0,0 +1,27 @@ +/* { dg-do run } */ +/* { dg-options "-O2" } */ + +extern void abort (void); + +int +main () +{ + struct A { char buf1[9]; char buf2[1]; } a; + + if (__builtin_object_size (a.buf1 + (0 + 4), 1) != 5) + abort (); + char *p = a.buf1; + p += 1; + p += 3; + if (__builtin_object_size (p, 1) != 5) + abort (); + p = (char *) &a; + char *q = p + 1; + char *r = q + 3; + char *t = r; + if (r != (char *) &a + 4) + t = (char *) &a + 1; + if (__builtin_object_size (t, 1) != 6) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/cpp/pr61977.c b/gcc/testsuite/gcc.dg/cpp/pr61977.c new file mode 100644 index 00000000000..faad4737497 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/pr61977.c @@ -0,0 +1,4 @@ +/* PR preprocessor/61977 */ +/* { dg-do preprocess } */ + +vector diff --git a/gcc/testsuite/gcc.dg/cpp/pr65238-2.c b/gcc/testsuite/gcc.dg/cpp/pr65238-2.c new file mode 100644 index 00000000000..c6a7aecddeb --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/pr65238-2.c @@ -0,0 +1,18 @@ +/* PR preprocessor/65238 */ +/* { dg-do preprocess } */ + +#if __has_attribute( +#endif +#if __has_attribute(unused +#endif +#if __has_attribute(unused, unused) +#endif +#if __has_attribute(__has_attribute(unused)) +#endif + +/* { dg-error "macro .__has_attribute. requires an identifier" "" {target "*-*-*"} 4 } */ +/* { dg-error "missing ... after .__has_attribute." "" {target "*-*-*"} 6 } */ +/* { dg-error "missing ... after .__has_attribute." "" {target "*-*-*"} 8 } */ +/* { dg-error "missing binary operator before token .unused." "" {target "*-*-*"} 8 } */ +/* { dg-error "macro .__has_attribute. requires an identifier" "" {target "*-*-*"} 10 } */ +/* { dg-error "missing ... in expression" "" {target "*-*-*"} 10 } */ diff --git a/gcc/testsuite/gcc.dg/cpp/trad/pr65238-3.c b/gcc/testsuite/gcc.dg/cpp/trad/pr65238-3.c new file mode 100644 index 00000000000..949dc005a1f --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/trad/pr65238-3.c @@ -0,0 +1,5 @@ +/* PR preprocessor/65238 */ +/* { dg-do run } */ +/* { dg-options "-traditional-cpp" } */ + +#include "../../../c-c++-common/cpp/pr65238-1.c" diff --git a/gcc/testsuite/gcc.dg/cpp/trad/pr65238-4.c b/gcc/testsuite/gcc.dg/cpp/trad/pr65238-4.c new file mode 100644 index 00000000000..cf2f449133c --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/trad/pr65238-4.c @@ -0,0 +1,19 @@ +/* PR preprocessor/65238 */ +/* { dg-do preprocess } */ +/* { dg-options "-traditional-cpp" } */ + +#if __has_attribute( +#endif +#if __has_attribute(unused +#endif +#if __has_attribute(unused, unused) +#endif +#if __has_attribute(__has_attribute(unused)) +#endif + +/* { dg-error "unterminated argument list invoking macro .__has_attribute." "" {target "*-*-*"} 5 } */ +/* { dg-error "#if with no expression" "" {target "*-*-*"} 5 } */ +/* { dg-error "unterminated argument list invoking macro .__has_attribute." "" {target "*-*-*"} 7 } */ +/* { dg-error "macro .__has_attribute. passed 2 arguments, but takes just 1" "" {target "*-*-*"} 9 } */ +/* { dg-error "missing ... in expression" "" {target "*-*-*"} 9 } */ +/* { dg-error "macro .__has_attribute. requires an identifier" "" {target "*-*-*"} 11 } */ diff --git a/gcc/testsuite/gcc.dg/gomp/openmp-simd-3.c b/gcc/testsuite/gcc.dg/gomp/openmp-simd-3.c new file mode 100644 index 00000000000..eba9de27d98 --- /dev/null +++ b/gcc/testsuite/gcc.dg/gomp/openmp-simd-3.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-fopenmp-simd -fdump-tree-original" } */ + +/* PR c/65586 */ + +void foo() { } + +int main() { +#pragma omp for collapse(1) + for (int i = 1; i <= 151; i+=31) + foo(); +} + +/* { dg-final { scan-tree-dump-not "omp" "original" } } */ +/* { dg-final { cleanup-tree-dump "original" } } */ diff --git a/gcc/testsuite/gcc.dg/graphite/vect-pr43423.c b/gcc/testsuite/gcc.dg/graphite/vect-pr43423.c index bd685a651c8..177017f7c7c 100644 --- a/gcc/testsuite/gcc.dg/graphite/vect-pr43423.c +++ b/gcc/testsuite/gcc.dg/graphite/vect-pr43423.c @@ -15,5 +15,5 @@ void foo(int n, int mid) } } -/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" } } */ +/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" { xfail *-*-* } } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/ipa/inlinehint-4.c b/gcc/testsuite/gcc.dg/ipa/inlinehint-4.c new file mode 100644 index 00000000000..52d2f1a6763 --- /dev/null +++ b/gcc/testsuite/gcc.dg/ipa/inlinehint-4.c @@ -0,0 +1,40 @@ +/* { dg-options "-O3 -fdump-ipa-inline-details -fno-early-inlining --param large-unit-insns=1" } */ +/* { dg-add-options bind_pic_locally } */ +int *hashval; +int *hash; +int hash_size; + +static int +lookup_slow (int val) +{ + int i = val % hash_size; + while (hashval[i] && hashval[i] != val) + i++; + return hash[i]; +} + +static inline int +lookup (int val) +{ + static int cache, cache_val; + if (val == cache_val) + return cache; + else + { + cache_val = val; + cache = lookup_slow (val); + return cache; + } +} + +int +test (int i) +{ + return lookup (i) + lookup (2 * i) + lookup (3 * i) + lookup (4 * i) + + lookup (5 * i) + lookup (6 * i) + lookup (7 * i) + lookup (8 * i) + + lookup (9 * i); +} +/* { dg-final { scan-ipa-dump "Wrapper penalty" "inline" } } */ +/* { dg-final { scan-ipa-dump-not "Inlining lookup_slow to lookup" "inline" } } */ +/* { dg-final { scan-ipa-dump "Inlining lookup to test" "inline" } } */ +/* { dg-final { cleanup-ipa-dump "inline" } } */ diff --git a/gcc/testsuite/gcc.dg/lto/chkp-ctor-merge_0.c b/gcc/testsuite/gcc.dg/lto/chkp-ctor-merge_0.c new file mode 100644 index 00000000000..ac4095bf012 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/chkp-ctor-merge_0.c @@ -0,0 +1,23 @@ +/* { dg-lto-do run } */ +/* { dg-require-effective-target mpx } */ +/* { dg-lto-options { { -O2 -flto -fcheck-pointer-bounds -mmpx -nodefaultlibs -lc } } } */ + +int glob = 1; + +void __attribute__((constructor)) +ctor1 () +{ + glob += 1; +} + + +void __attribute__((constructor)) +ctor2 () +{ + glob -= 2; +} + +int main (int argc, const char **argv) +{ + return glob; +} diff --git a/gcc/testsuite/gcc.dg/lto/chkp-static-bounds_0.c b/gcc/testsuite/gcc.dg/lto/chkp-static-bounds_0.c new file mode 100644 index 00000000000..596e5510664 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/chkp-static-bounds_0.c @@ -0,0 +1,26 @@ +/* { dg-lto-do link } */ +/* { dg-require-effective-target mpx } */ +/* { dg-lto-options { { -flto -flto-partition=max -fcheck-pointer-bounds -mmpx } } } */ + +const char *cc; + +int test1 (const char *c) +{ + c = __builtin___bnd_init_ptr_bounds (c); + cc = c; + return c[0] * 2; +} + +struct S +{ + int (*fnptr) (const char *); +} S; + +struct S s1 = {test1}; +struct S s2 = {test1}; +struct S s3 = {test1}; + +int main (int argc, const char **argv) +{ + return s1.fnptr (argv[0]) + s2.fnptr (argv[1]); +} diff --git a/gcc/testsuite/gcc.dg/pr23623.c b/gcc/testsuite/gcc.dg/pr23623.c index 7ba1470182d..e076b600335 100644 --- a/gcc/testsuite/gcc.dg/pr23623.c +++ b/gcc/testsuite/gcc.dg/pr23623.c @@ -10,19 +10,19 @@ extern struct { unsigned int b : 1; unsigned int : 31; -} bf1; +} __attribute__((aligned(4))) bf1; extern volatile struct { unsigned int b : 1; unsigned int : 31; -} bf2; +} __attribute__((aligned(4))) bf2; extern struct { volatile unsigned int b : 1; volatile unsigned int : 31; -} bf3; +} __attribute__((aligned(4))) bf3; void writeb(void) { diff --git a/gcc/testsuite/gcc.dg/pr29215.c b/gcc/testsuite/gcc.dg/pr29215.c index aa3f82ce0e1..9869c85d430 100644 --- a/gcc/testsuite/gcc.dg/pr29215.c +++ b/gcc/testsuite/gcc.dg/pr29215.c @@ -1,6 +1,6 @@ /* PR middle-end/29215 */ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-gimple" } */ +/* { dg-options "-O2 -fdump-tree-ccp1" } */ char buf[5 * sizeof (int) + 1] __attribute__((aligned (__alignof__ (int)))); @@ -29,5 +29,5 @@ main (void) return 0; } -/* { dg-final { scan-tree-dump-not "memcpy" "gimple" } } */ -/* { dg-final { cleanup-tree-dump "gimple" } } */ +/* { dg-final { scan-tree-dump-not "memcpy" "ccp1" } } */ +/* { dg-final { cleanup-tree-dump "ccp1" } } */ diff --git a/gcc/testsuite/gcc.dg/pr64715-1.c b/gcc/testsuite/gcc.dg/pr64715-1.c new file mode 100644 index 00000000000..fbb635393fb --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr64715-1.c @@ -0,0 +1,23 @@ +/* PR tree-optimization/64715 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ + +extern inline __attribute__ ((always_inline, gnu_inline, artificial, nothrow, leaf)) char * +strcpy (char *__restrict dest, const char *__restrict src) +{ + return __builtin___strcpy_chk (dest, src, __builtin_object_size (dest, 2 > 1)); +} + +const char *str1 = "JIHGFEDCBA"; +void bar (char *); + +void +foo () +{ + struct A { char buf1[9]; char buf2[1]; } a; + strcpy (a.buf1 + (0 + 4), str1 + 5); + bar ((char *) &a); +} + +/* { dg-final { scan-tree-dump "__builtin___strcpy_chk\[^;\n\r\]*, 5\\\);" "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/pr64715-2.c b/gcc/testsuite/gcc.dg/pr64715-2.c new file mode 100644 index 00000000000..4c7b581f60e --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr64715-2.c @@ -0,0 +1,19 @@ +/* PR tree-optimization/64715 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ + +void bar (char *, int); + +void +foo (int x) +{ + char p[16], *q; + q = p; + if (x) + q = p + 3; + __builtin___strcpy_chk (q, "abcdefghijkl", __builtin_object_size (q, 1)); + bar (p, x); +} + +/* { dg-final { scan-tree-dump "__builtin_memcpy \\\(\[^;\n\r\]*, \"abcdefghijkl\", 13\\\);" "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/pr65521.c b/gcc/testsuite/gcc.dg/pr65521.c new file mode 100644 index 00000000000..97879e2e139 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr65521.c @@ -0,0 +1,39 @@ +/* PR ipa/65521 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fcompare-debug" } */ + +struct S { int s; }; +int f6 (void *, unsigned long); +int f7 (int, int *, unsigned long); +int f8 (void); +int f9 (void (*) (void)); + +int +f1 (void *p) +{ + return f6 (p, 256UL); +} + +int +f2 (void *p) +{ + return f6 (p, 256UL); +} + +int +f3 (struct S *x) +{ + return f7 (f8 (), &x->s, 16UL); +} + +int +f4 (struct S *x) +{ + return f7 (f8 (), &x->s, 16UL); +} + +void +f5 (void) +{ + f9 (f5); +} diff --git a/gcc/testsuite/gcc.dg/pr65533.c b/gcc/testsuite/gcc.dg/pr65533.c new file mode 100644 index 00000000000..49edf15c00e --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr65533.c @@ -0,0 +1,25 @@ +/* PR tree-optimization/65533 */ +/* { dg-do compile } */ +/* { dg-options "-Ofast -w" } */ + +struct A { int a[2]; }; +struct B { double b[2]; }; +struct C { double c[4][1]; }; + +static inline void +bar (struct B *x, double y, double z) +{ + x->b[0] = y; + x->b[1] = z; +} + +void baz (struct B *); + +void +foo (struct C *x, struct A *y) +{ + struct B d; + bar (&d, x->c[1][0] * y->a[0] + x->c[0][1] * y->a[1] + x->c[0][0] * x->c[0][1], + x->c[0][0] * y->a[0] + x->c[0][1] * y->a[1] + x->c[0][1] * y->a[0] + x->c[0][0]); + baz (&d); +} diff --git a/gcc/testsuite/gcc.dg/torture/pr65517.c b/gcc/testsuite/gcc.dg/torture/pr65517.c new file mode 100644 index 00000000000..a63a03a870a --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr65517.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */
+
+typedef void (*argmatch_exit_fn)();
+int a;
+void __argmatch_die () { __builtin_exit (0); }
+
+int
+main ()
+{
+ while (1)
+ {
+ argmatch_exit_fn b = __argmatch_die;
+ if (a)
+ b ();
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-10.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-10.c new file mode 100644 index 00000000000..4acf580e1d7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-10.c @@ -0,0 +1,24 @@ +/* PR 65177 */ +/* { dg-do compile } */ +/* { dg-options "-O3" } */ + +typedef struct p7_profile_s {} P7_PROFILE; +enum p7t_statetype_e { + p7T_S = 4, p7T_N = 5, p7T_E = 7, p7T_C = 8, p7T_J = 10, }; +typedef struct p7_trace_s {} P7_TRACE; +typedef struct p7_gmx_s { + int L; +} P7_GMX; +static inline int select_c(const P7_PROFILE *gm, const P7_GMX *pp, const P7_GMX *gx, int i) { + float path[2]; + return ((path[0] > path[1]) ? p7T_C : p7T_E); +} +void p7_GOATrace(const P7_PROFILE *gm, const P7_GMX *pp, const P7_GMX *gx, P7_TRACE *tr) { + int i = gx->L; + int sprv, scur; + while (sprv != p7T_S) { + switch (sprv) { case p7T_C: scur = select_c(gm, pp, gx, i); break; } + if ( (scur == p7T_N || scur == p7T_J || scur == p7T_C) && scur == sprv) i--; + sprv = scur; + } +} diff --git a/gcc/testsuite/gcc.dg/vect/costmodel/ppc/costmodel-bb-slp-9a-pr63175.c b/gcc/testsuite/gcc.dg/vect/costmodel/ppc/costmodel-bb-slp-9a-pr63175.c index 73c0afa02dc..bf6053dde8f 100644 --- a/gcc/testsuite/gcc.dg/vect/costmodel/ppc/costmodel-bb-slp-9a-pr63175.c +++ b/gcc/testsuite/gcc.dg/vect/costmodel/ppc/costmodel-bb-slp-9a-pr63175.c @@ -25,6 +25,6 @@ main1 (void) with no word loads (lw, lwu, lwz, lwzu, or their indexed forms) or word stores (stw, stwu, stwx, stwux, or their indexed forms). */ -/* { dg-final { scan-assembler "\t\(lxv|lvsr|stxv\)" } } */ +/* { dg-final { scan-assembler "\t(lvx|lxv|lvsr|stxv)" } } */ /* { dg-final { scan-assembler-not "\tlwz?u?x? " } } */ /* { dg-final { scan-assembler-not "\tstwu?x? " } } */ diff --git a/gcc/testsuite/gcc.dg/vect/pr65494.c b/gcc/testsuite/gcc.dg/vect/pr65494.c new file mode 100644 index 00000000000..753985f7e50 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr65494.c @@ -0,0 +1,28 @@ +/* { dg-do compile } */
+/* { dg-additional-options "-Ofast -funroll-loops" } */
+
+typedef unsigned char uchar;
+typedef struct rgb_ {uchar r; uchar g; uchar b;} rgb;
+#define N 512
+rgb in[N], out[N];
+float c[N];
+void foo(int n)
+{
+ int i, j;
+ for (i = 0; i < n; i++) //in and out are RGB byte arrays
+ {
+ float r = 0, g = 0, b = 0;
+ for (j = 0; j < 5; j++)
+ {
+ r += (float)in[i + j].r * c[j];
+ g += (float)in[i + j].g * c[j];
+ b += (float)in[i + j].b * c[j];
+ }
+ out[i].r = (uchar)r;
+ out[i].g = (uchar)g;
+ out[i].b = (uchar)b;
+ }
+}
+
+/* { dg-final { scan-tree-dump "vectorized 1 loops in function" "vect" { target { vect_float && vect_intfloat_cvt } } } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.dg/vect/pr65518.c b/gcc/testsuite/gcc.dg/vect/pr65518.c new file mode 100644 index 00000000000..dc400c6d823 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr65518.c @@ -0,0 +1,43 @@ +/* { dg-do run } */
+
+extern void abort (void);
+
+typedef struct giga
+{
+ unsigned int g[16];
+} giga;
+
+unsigned long __attribute__((noinline,noclone))
+addfst(giga const *gptr, int num)
+{
+ unsigned int retval = 0;
+ int i;
+ for (i = 0; i < num; i++)
+ retval += gptr[i].g[0];
+ return retval;
+}
+
+int main ()
+{
+ struct giga g[8];
+ unsigned int n = 1;
+ int i, j;
+ for (i = 0; i < 8; ++i)
+ for (j = 0; j < 16; ++j)
+ {
+ g[i].g[j] = n++;
+ __asm__ volatile ("");
+ }
+ if (addfst (g, 8) != 456)
+ abort ();
+ return 0;
+}
+
+/* We don't want to vectorize the single-element interleaving in the way
+ we currently do that (without ignoring not needed vectors in the
+ gap between gptr[0].g[0] and gptr[1].g[0]), because that's very
+ sub-optimal and causes memory explosion (even though the cost model
+ should reject that in the end). */
+
+/* { dg-final { scan-tree-dump-times "vectorized 0 loops in function" 2 "vect" } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
|