diff options
author | mrs <mrs@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-12-13 17:31:30 +0000 |
---|---|---|
committer | mrs <mrs@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-12-13 17:31:30 +0000 |
commit | 3dd775fb895cffb77ac74098a74e9fca28edaf79 (patch) | |
tree | f68062e9cfe09046337dc976767a5f7938462868 /gcc/testsuite/gcc.dg | |
parent | 84014c53e113ab540befd1eceb8598d28a323ab3 (diff) | |
parent | 34a5d2a56d4b0a0ea74339c985c919aabfc530a4 (diff) | |
download | gcc-3dd775fb895cffb77ac74098a74e9fca28edaf79.tar.gz |
Merge in trunk.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/wide-int@205966 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg')
37 files changed, 715 insertions, 19 deletions
diff --git a/gcc/testsuite/gcc.dg/c11-align-6.c b/gcc/testsuite/gcc.dg/c11-align-6.c new file mode 100644 index 00000000000..7ea994da400 --- /dev/null +++ b/gcc/testsuite/gcc.dg/c11-align-6.c @@ -0,0 +1,40 @@ +/* Test C11 _Alignof returning minimum alignment for a type. PR + 52023. */ +/* { dg-do run } */ +/* { dg-options "-std=c11" } */ + +extern void abort (void); +extern void exit (int); + +#define CHECK_ALIGN(TYPE) \ + do \ + { \ + struct { char c; TYPE v; } x; \ + if (_Alignof (TYPE) > __alignof__ (x.v)) \ + abort (); \ + } \ + while (0) + +int +main (void) +{ + CHECK_ALIGN (_Bool); + CHECK_ALIGN (char); + CHECK_ALIGN (signed char); + CHECK_ALIGN (unsigned char); + CHECK_ALIGN (signed short); + CHECK_ALIGN (unsigned short); + CHECK_ALIGN (signed int); + CHECK_ALIGN (unsigned int); + CHECK_ALIGN (signed long); + CHECK_ALIGN (unsigned long); + CHECK_ALIGN (signed long long); + CHECK_ALIGN (unsigned long long); + CHECK_ALIGN (float); + CHECK_ALIGN (double); + CHECK_ALIGN (long double); + CHECK_ALIGN (_Complex float); + CHECK_ALIGN (_Complex double); + CHECK_ALIGN (_Complex long double); + exit (0); +} diff --git a/gcc/testsuite/gcc.dg/cpp/expr-overflow-1.c b/gcc/testsuite/gcc.dg/cpp/expr-overflow-1.c new file mode 100644 index 00000000000..8a67aaa6d46 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/expr-overflow-1.c @@ -0,0 +1,44 @@ +/* Test overflow in preprocessor arithmetic. PR 55715. */ +/* { dg-do preprocess } */ +/* { dg-options "-std=c99" } */ + +#include <stdint.h> + +#if -1 - INTMAX_MIN +#endif + +#if 0 - INTMAX_MIN /* { dg-warning "overflow" } */ +#endif + +#if 1 * INTMAX_MIN +#endif + +#if -1 * INTMAX_MIN /* { dg-warning "overflow" } */ +#endif + +#if 0 * INTMAX_MIN +#endif + +#if -INTMAX_MIN /* { dg-warning "overflow" } */ +#endif + +#if +INTMAX_MIN +#endif + +#if INTMAX_MIN / 1 +#endif + +#if INTMAX_MIN / -1 /* { dg-warning "overflow" } */ +#endif + +#if UINTMAX_MAX * UINTMAX_MAX +#endif + +#if UINTMAX_MAX / -1 +#endif + +#if UINTMAX_MAX + INTMAX_MAX +#endif + +#if UINTMAX_MAX - INTMAX_MIN +#endif diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-pta-14.c b/gcc/testsuite/gcc.dg/ipa/ipa-pta-14.c index ed59cbfda00..b62b08ff03a 100644 --- a/gcc/testsuite/gcc.dg/ipa/ipa-pta-14.c +++ b/gcc/testsuite/gcc.dg/ipa/ipa-pta-14.c @@ -21,9 +21,8 @@ int main() void *p; a.p = (void *)&c; p = foo(&a, &a); - /* { dg-final { scan-ipa-dump "foo.result = { NULL a\[^ \]* c\[^ \]* }" "pta" { xfail *-*-* } } } */ - /* { dg-final { scan-ipa-dump "foo.result = { NULL a\[^ \]* a\[^ \]* c\[^ \]* }" "pta" { target { ! keeps_null_pointer_checks } } } } */ - /* { dg-final { scan-ipa-dump "foo.result = { NONLOCAL a\[^ \]* a\[^ \]* c\[^ \]* }" "pta" { target { keeps_null_pointer_checks } } } } */ + /* { dg-final { scan-ipa-dump "foo.result = { NULL a\[^ \]* c\[^ \]* }" "pta" { target { ! keeps_null_pointer_checks } } } } */ + /* { dg-final { scan-ipa-dump "foo.result = { NONLOCAL a\[^ \]* c\[^ \]* }" "pta" { target { keeps_null_pointer_checks } } } } */ ((struct X *)p)->p = (void *)0; if (a.p != (void *)0) abort (); diff --git a/gcc/testsuite/gcc.dg/macro-fusion-1.c b/gcc/testsuite/gcc.dg/macro-fusion-1.c index 4ac98668bdc..b2d11423acf 100644 --- a/gcc/testsuite/gcc.dg/macro-fusion-1.c +++ b/gcc/testsuite/gcc.dg/macro-fusion-1.c @@ -1,6 +1,5 @@ /* { dg-do compile { target i?86-*-* x86_64-*-* } } */ /* { dg-options "-O2 -mtune=corei7 -fdump-rtl-sched2" } */ -/* { dg-final { scan-rtl-dump-not "compare.*insn.*jump_insn.*jump_insn" "sched2" } } */ int a[100]; @@ -11,3 +10,6 @@ double bar (double sum) sum += (0.5 + (a[i%100] - 128)); return sum; } + +/* { dg-final { scan-rtl-dump-not "compare.*insn.*jump_insn.*jump_insn" "sched2" } } */ +/* { dg-final { cleanup-rtl-dump "sched2" } } */ diff --git a/gcc/testsuite/gcc.dg/macro-fusion-2.c b/gcc/testsuite/gcc.dg/macro-fusion-2.c index 638350d9926..ad7489a73ad 100644 --- a/gcc/testsuite/gcc.dg/macro-fusion-2.c +++ b/gcc/testsuite/gcc.dg/macro-fusion-2.c @@ -1,6 +1,5 @@ /* { dg-do compile { target i?86-*-* x86_64-*-* } } */ /* { dg-options "-O2 -mtune=corei7-avx -fdump-rtl-sched2" } */ -/* { dg-final { scan-rtl-dump-not "compare.*insn.*jump_insn.*jump_insn" "sched2" } } */ int a[100]; @@ -14,3 +13,6 @@ double bar (double sum) } return sum; } + +/* { dg-final { scan-rtl-dump-not "compare.*insn.*jump_insn.*jump_insn" "sched2" } } */ +/* { dg-final { cleanup-rtl-dump "sched2" } } */ diff --git a/gcc/testsuite/gcc.dg/plugin/selfassign.c b/gcc/testsuite/gcc.dg/plugin/selfassign.c index be5a204c901..041f25dce34 100644 --- a/gcc/testsuite/gcc.dg/plugin/selfassign.c +++ b/gcc/testsuite/gcc.dg/plugin/selfassign.c @@ -261,7 +261,7 @@ execute_warn_self_assign (void) gimple_stmt_iterator gsi; basic_block bb; - FOR_EACH_BB (bb) + FOR_EACH_BB_FN (bb, cfun) { for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) warn_self_assign (gsi_stmt (gsi)); diff --git a/gcc/testsuite/gcc.dg/pr23623.c b/gcc/testsuite/gcc.dg/pr23623.c new file mode 100644 index 00000000000..c844f945e1a --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr23623.c @@ -0,0 +1,48 @@ +/* { dg-do compile } */ +/* { dg-options "-fstrict-volatile-bitfields -fdump-rtl-final" } */ + +/* With -fstrict-volatile-bitfields, the volatile accesses to bf2.b + and bf3.b must do unsigned int reads/writes. The non-volatile + accesses to bf1.b are not so constrained. */ + +extern struct +{ + unsigned int b : 1; + unsigned int : 31; +} bf1; + +extern volatile struct +{ + unsigned int b : 1; + unsigned int : 31; +} bf2; + +extern struct +{ + volatile unsigned int b : 1; + volatile unsigned int : 31; +} bf3; + +void writeb(void) +{ + bf1.b = 1; + bf2.b = 1; /* volatile read + volatile write */ + bf3.b = 1; /* volatile read + volatile write */ +} + +extern unsigned int x1, x2, x3; + +void readb(void) +{ + x1 = bf1.b; + x2 = bf2.b; /* volatile write */ + x3 = bf3.b; /* volatile write */ +} + +/* There should be 6 volatile MEMs total, but scan-rtl-dump-times counts + the number of match variables and not the number of matches. Since + the parenthesized subexpression in the regexp introduces an extra match + variable, we need to give a count of 12 instead of 6 here. */ +/* { dg-final { scan-rtl-dump-times "mem/v(/.)*:SI" 12 "final" } } */ +/* { dg-final { cleanup-rtl-dump "final" } } */ + diff --git a/gcc/testsuite/gcc.dg/pr38984.c b/gcc/testsuite/gcc.dg/pr38984.c index 0c031805ea8..3ccb0e492fc 100644 --- a/gcc/testsuite/gcc.dg/pr38984.c +++ b/gcc/testsuite/gcc.dg/pr38984.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fno-delete-null-pointer-checks -fdump-tree-optimized -fno-isolate-erroneous-paths" } +/* { dg-options "-O2 -fno-delete-null-pointer-checks -fdump-tree-optimized -fno-isolate-erroneous-paths-dereference" } * */ int f(int *p) diff --git a/gcc/testsuite/gcc.dg/pr41488.c b/gcc/testsuite/gcc.dg/pr41488.c new file mode 100644 index 00000000000..c4bc42832b3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr41488.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-sccp-scev" } */ + +struct struct_t +{ + int* data; +}; + +void foo (struct struct_t* sp, int start, int end) +{ + int i; + + for (i = 0; i+start < end; i++) + sp->data[i+start] = 0; +} + +/* { dg-final { scan-tree-dump-times "Simplify PEELED_CHREC into POLYNOMIAL_CHREC" 1 "sccp" } } */ +/* { dg-final { cleanup-tree-dump "sccp" } } */ diff --git a/gcc/testsuite/gcc.dg/pr48784-1.c b/gcc/testsuite/gcc.dg/pr48784-1.c new file mode 100644 index 00000000000..bbcad9b18ed --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr48784-1.c @@ -0,0 +1,18 @@ +/* { dg-do run } */ +/* { dg-options "-fstrict-volatile-bitfields" } */ + +extern void abort (void); + +#pragma pack(1) +volatile struct S0 { + signed a : 7; + unsigned b : 28; /* b can't be fetched with an aligned 32-bit access, */ + /* but it certainly can be fetched with an unaligned access */ +} g = {0,0xfffffff}; + +int main() { + unsigned b = g.b; + if (b != 0xfffffff) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/pr48784-2.c b/gcc/testsuite/gcc.dg/pr48784-2.c new file mode 100644 index 00000000000..6d532631294 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr48784-2.c @@ -0,0 +1,18 @@ +/* { dg-do run } */ +/* { dg-options "-fno-strict-volatile-bitfields" } */ + +extern void abort (void); + +#pragma pack(1) +volatile struct S0 { + signed a : 7; + unsigned b : 28; /* b can't be fetched with an aligned 32-bit access, */ + /* but it certainly can be fetched with an unaligned access */ +} g = {0,0xfffffff}; + +int main() { + unsigned b = g.b; + if (b != 0xfffffff) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/pr54113.c b/gcc/testsuite/gcc.dg/pr54113.c new file mode 100644 index 00000000000..4c68099b364 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr54113.c @@ -0,0 +1,5 @@ +/* { dg-do compile } */ +/* { dg-options "-Wmissing-prototypes" } */ + +inline int foo (void) { return 42; } /* { dg-bogus "no previous prototype" } */ +extern int foo(void); diff --git a/gcc/testsuite/gcc.dg/pr56341-1.c b/gcc/testsuite/gcc.dg/pr56341-1.c new file mode 100644 index 00000000000..91cf80ba286 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr56341-1.c @@ -0,0 +1,40 @@ +/* { dg-do run } */ +/* { dg-options "-fstrict-volatile-bitfields" } */ + +extern void abort (void); + +struct test0 +{ + unsigned char b1[2]; +} __attribute__((packed, aligned(2))); + +struct test1 +{ + volatile unsigned long a1; + unsigned char b1[4]; +} __attribute__((packed, aligned(2))); + +struct test2 +{ + struct test0 t0; + struct test1 t1; + struct test0 t2; +} __attribute__((packed, aligned(2))); + +struct test2 xx; +struct test2 *x1 = &xx; + +#define MAGIC 0x12345678 + +void test0 (struct test2* x1) +{ + x1->t1.a1 = MAGIC; +} + +int main() +{ + test0 (x1); + if (xx.t1.a1 != MAGIC) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/pr56341-2.c b/gcc/testsuite/gcc.dg/pr56341-2.c new file mode 100644 index 00000000000..e6f6569f089 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr56341-2.c @@ -0,0 +1,40 @@ +/* { dg-do run } */ +/* { dg-options "-fno-strict-volatile-bitfields" } */ + +extern void abort (void); + +struct test0 +{ + unsigned char b1[2]; +} __attribute__((packed, aligned(2))); + +struct test1 +{ + volatile unsigned long a1; + unsigned char b1[4]; +} __attribute__((packed, aligned(2))); + +struct test2 +{ + struct test0 t0; + struct test1 t1; + struct test0 t2; +} __attribute__((packed, aligned(2))); + +struct test2 xx; +struct test2 *x1 = &xx; + +#define MAGIC 0x12345678 + +void test0 (struct test2* x1) +{ + x1->t1.a1 = MAGIC; +} + +int main() +{ + test0 (x1); + if (xx.t1.a1 != MAGIC) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/pr56997-1.c b/gcc/testsuite/gcc.dg/pr56997-1.c new file mode 100644 index 00000000000..42458a106c6 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr56997-1.c @@ -0,0 +1,44 @@ +/* Test volatile access to unaligned field. */ +/* { dg-do run } */ +/* { dg-options "-fstrict-volatile-bitfields" } */ + +extern void abort (void); + +#define test_type unsigned short +#define MAGIC (unsigned short)0x102u + +typedef struct s{ + unsigned char Prefix; + test_type Type; +}__attribute((__packed__)) ss; + +volatile ss v; +ss g; + +void __attribute__((noinline)) +foo (test_type u) +{ + v.Type = u; +} + +test_type __attribute__((noinline)) +bar (void) +{ + return v.Type; +} + +int main() +{ + test_type temp; + foo(MAGIC); + __builtin_memcpy(&g, (void *)&v, sizeof(g)); + if (g.Type != MAGIC) + abort (); + + g.Type = MAGIC; + __builtin_memcpy((void *)&v, &g, sizeof(v)); + temp = bar(); + if (temp != MAGIC) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/pr56997-2.c b/gcc/testsuite/gcc.dg/pr56997-2.c new file mode 100644 index 00000000000..08e631180f1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr56997-2.c @@ -0,0 +1,44 @@ +/* Test volatile access to unaligned field. */ +/* { dg-do run } */ +/* { dg-options "-fstrict-volatile-bitfields" } */ + +extern void abort (void); + +#define test_type unsigned int +#define MAGIC 0x1020304u + +typedef struct s{ + unsigned char Prefix; + test_type Type; +}__attribute((__packed__)) ss; + +volatile ss v; +ss g; + +void __attribute__((noinline)) +foo (test_type u) +{ + v.Type = u; +} + +test_type __attribute__((noinline)) +bar (void) +{ + return v.Type; +} + +int main() +{ + test_type temp; + foo(MAGIC); + __builtin_memcpy(&g, (void *)&v, sizeof(g)); + if (g.Type != MAGIC) + abort (); + + g.Type = MAGIC; + __builtin_memcpy((void *)&v, &g, sizeof(v)); + temp = bar(); + if (temp != MAGIC) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/pr56997-3.c b/gcc/testsuite/gcc.dg/pr56997-3.c new file mode 100644 index 00000000000..3754b108ac6 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr56997-3.c @@ -0,0 +1,44 @@ +/* Test volatile access to unaligned field. */ +/* { dg-do run } */ +/* { dg-options "-fstrict-volatile-bitfields" } */ + +extern void abort (void); + +#define test_type unsigned long long +#define MAGIC 0x102030405060708ull + +typedef struct s{ + unsigned char Prefix; + test_type Type; +}__attribute((__packed__)) ss; + +volatile ss v; +ss g; + +void __attribute__((noinline)) +foo (test_type u) +{ + v.Type = u; +} + +test_type __attribute__((noinline)) +bar (void) +{ + return v.Type; +} + +int main() +{ + test_type temp; + foo(MAGIC); + __builtin_memcpy(&g, (void *)&v, sizeof(g)); + if (g.Type != MAGIC) + abort (); + + g.Type = MAGIC; + __builtin_memcpy((void *)&v, &g, sizeof(v)); + temp = bar(); + if (temp != MAGIC) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/pubtypes-1.c b/gcc/testsuite/gcc.dg/pubtypes-1.c index 5c6767e8faa..3f09646c806 100644 --- a/gcc/testsuite/gcc.dg/pubtypes-1.c +++ b/gcc/testsuite/gcc.dg/pubtypes-1.c @@ -2,7 +2,7 @@ /* { dg-options "-O0 -gdwarf-2 -dA -fno-eliminate-unused-debug-types" } */ /* { dg-skip-if "Unmatchable assembly" { mmix-*-* } { "*" } { "" } } */ /* { dg-final { scan-assembler "__debug_pubtypes" } } */ -/* { dg-final { scan-assembler "long+\[ \t\]+0x\[0-9a-f]+\[ \t\]+\[#;]+\[ \t\]+Length of Public Type Names Info" } } */ +/* { dg-final { scan-assembler "long+\[ \t\]+0x\[0-9a-f]+\[ \t\]+\[#;]+\[ \t\]+Pub Info Length" } } */ /* { dg-final { scan-assembler "used_struct\\\\0\"+\[ \t\]+\[#;]+\[ \t\]+external name" } } */ /* { dg-final { scan-assembler "unused_struct\\\\0\"+\[ \t\]+\[#;]+\[ \t\]+external name" } } */ diff --git a/gcc/testsuite/gcc.dg/pubtypes-2.c b/gcc/testsuite/gcc.dg/pubtypes-2.c index 22f61d380ab..b4ba8712c5e 100644 --- a/gcc/testsuite/gcc.dg/pubtypes-2.c +++ b/gcc/testsuite/gcc.dg/pubtypes-2.c @@ -2,7 +2,7 @@ /* { dg-options "-O0 -gdwarf-2 -dA" } */ /* { dg-skip-if "Unmatchable assembly" { mmix-*-* } { "*" } { "" } } */ /* { dg-final { scan-assembler "__debug_pubtypes" } } */ -/* { dg-final { scan-assembler "long+\[ \t\]+0x13b+\[ \t\]+\[#;]+\[ \t\]+Length of Public Type Names Info" } } */ +/* { dg-final { scan-assembler "long+\[ \t\]+0x13b+\[ \t\]+\[#;]+\[ \t\]+Pub Info Length" } } */ /* { dg-final { scan-assembler "used_struct\\\\0\"+\[ \t\]+\[#;]+\[ \t\]+external name" } } */ /* { dg-final { scan-assembler-not "unused_struct\\\\0\"+\[ \t\]+\[#;]+\[ \t\]+external name" } } */ diff --git a/gcc/testsuite/gcc.dg/pubtypes-3.c b/gcc/testsuite/gcc.dg/pubtypes-3.c index d3fa57619a8..f4b0468ab19 100644 --- a/gcc/testsuite/gcc.dg/pubtypes-3.c +++ b/gcc/testsuite/gcc.dg/pubtypes-3.c @@ -2,7 +2,7 @@ /* { dg-options "-O0 -gdwarf-2 -dA" } */ /* { dg-skip-if "Unmatchable assembly" { mmix-*-* } { "*" } { "" } } */ /* { dg-final { scan-assembler "__debug_pubtypes" } } */ -/* { dg-final { scan-assembler "long+\[ \t\]+0x13b+\[ \t\]+\[#;]+\[ \t\]+Length of Public Type Names Info" } } */ +/* { dg-final { scan-assembler "long+\[ \t\]+0x13b+\[ \t\]+\[#;]+\[ \t\]+Pub Info Length" } } */ /* { dg-final { scan-assembler "used_struct\\\\0\"+\[ \t\]+\[#;]+\[ \t\]+external name" } } */ /* { dg-final { scan-assembler-not "unused_struct\\\\0\"+\[ \t\]+\[#;]+\[ \t\]+external name" } } */ /* { dg-final { scan-assembler-not "\"list_name_type\\\\0\"+\[ \t\]+\[#;]+\[ \t\]+external name" } } */ diff --git a/gcc/testsuite/gcc.dg/pubtypes-4.c b/gcc/testsuite/gcc.dg/pubtypes-4.c index f974c4b2b31..76d7c4a9805 100644 --- a/gcc/testsuite/gcc.dg/pubtypes-4.c +++ b/gcc/testsuite/gcc.dg/pubtypes-4.c @@ -2,7 +2,7 @@ /* { dg-options "-O0 -gdwarf-2 -dA" } */ /* { dg-skip-if "Unmatchable assembly" { mmix-*-* } { "*" } { "" } } */ /* { dg-final { scan-assembler "__debug_pubtypes" } } */ -/* { dg-final { scan-assembler "long+\[ \t\]+0x172+\[ \t\]+\[#;]+\[ \t\]+Length of Public Type Names Info" } } */ +/* { dg-final { scan-assembler "long+\[ \t\]+0x172+\[ \t\]+\[#;]+\[ \t\]+Pub Info Length" } } */ /* { dg-final { scan-assembler "used_struct\\\\0\"+\[ \t\]+\[#;]+\[ \t\]+external name" } } */ /* { dg-final { scan-assembler-not "unused_struct\\\\0\"+\[ \t\]+\[#;]+\[ \t\]+external name" } } */ /* { dg-final { scan-assembler "\"list_name_type\\\\0\"+\[ \t\]+\[#;]+\[ \t\]+external name" } } */ diff --git a/gcc/testsuite/gcc.dg/torture/pr59058.c b/gcc/testsuite/gcc.dg/torture/pr59058.c new file mode 100644 index 00000000000..b3a5a3960c3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr59058.c @@ -0,0 +1,19 @@ +/* { dg-do run } */ + +extern void abort (void); + +short b = 0; + +int +main () +{ + int c = 0; +l1: + b++; + c |= b; + if (b) + goto l1; + if (c != -1) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr59374-1.c b/gcc/testsuite/gcc.dg/torture/pr59374-1.c new file mode 100644 index 00000000000..6230ae9ca3d --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr59374-1.c @@ -0,0 +1,24 @@ +/* { dg-do run } */ +/* { dg-additional-options "-ftree-slp-vectorize" } */ + +extern void abort (void); + +static struct X { void *a; void *b; } a, b; + +void __attribute__((noinline)) +foo (void) +{ + void *tem = a.b; + a.b = (void *)0; + b.b = tem; + b.a = a.a; +} + +int main() +{ + a.b = &a; + foo (); + if (b.b != &a) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr59374-2.c b/gcc/testsuite/gcc.dg/torture/pr59374-2.c new file mode 100644 index 00000000000..d791b987ef6 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr59374-2.c @@ -0,0 +1,26 @@ +/* { dg-do run } */ +/* { dg-additional-options "-ftree-slp-vectorize" } */ + +extern void abort (void); + +static struct X { void *a; void *b; } a, b; +static struct X *p; + +void __attribute__((noinline)) +foo (void) +{ + void *tem = a.b; + p->b = (void *)0; + b.b = tem; + b.a = a.a; +} + +int main() +{ + p = &a; + a.b = &a; + foo (); + if (b.b != &a) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/tree-ssa/isolate-2.c b/gcc/testsuite/gcc.dg/tree-ssa/isolate-2.c index 290b44c5bd4..bfcaa2b01da 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/isolate-2.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/isolate-2.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-isolate-paths -fdump-tree-phicprop1" } */ +/* { dg-options "-O2 -fisolate-erroneous-paths-attribute -fdump-tree-isolate-paths -fdump-tree-phicprop1" } */ int z; diff --git a/gcc/testsuite/gcc.dg/tree-ssa/isolate-4.c b/gcc/testsuite/gcc.dg/tree-ssa/isolate-4.c index 6937d25580a..c9c074df62b 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/isolate-4.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/isolate-4.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-isolate-paths -fdump-tree-phicprop1" } */ +/* { dg-options "-O2 -fisolate-erroneous-paths-attribute -fdump-tree-isolate-paths -fdump-tree-phicprop1" } */ extern void foo(void *) __attribute__ ((__nonnull__ (1))); diff --git a/gcc/testsuite/gcc.dg/tree-ssa/loop-31.c b/gcc/testsuite/gcc.dg/tree-ssa/loop-31.c index 4f226374bdb..fa18f5e0421 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/loop-31.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/loop-31.c @@ -15,7 +15,7 @@ short foo (int len, int v) /* When we do not have addressing mode including multiplication, the memory access should be strength-reduced. */ -/* { dg-final { scan-tree-dump-times " \\+ 2" 1 "optimized" { target arm*-*-* } } } */ -/* { dg-final { scan-tree-dump-times " \\+ 2" 1 "optimized" { target { ia64-*-* && ilp32 } } } } */ -/* { dg-final { scan-tree-dump-times " \\+ 2" 2 "optimized" { target { ia64-*-* && lp64 } } } } */ +/* { dg-final { scan-tree-dump-times " \\+ 2;" 1 "optimized" { target arm*-*-* } } } */ +/* { dg-final { scan-tree-dump-times " \\+ 2;" 1 "optimized" { target { ia64-*-* && ilp32 } } } } */ +/* { dg-final { scan-tree-dump-times " \\+ 2;" 2 "optimized" { target { ia64-*-* && lp64 } } } } */ /* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr45085.c b/gcc/testsuite/gcc.dg/tree-ssa/pr45085.c new file mode 100644 index 00000000000..d95ac8620ca --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr45085.c @@ -0,0 +1,46 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -Wuninitialized" } */ +struct S { char *s1; long s2; }; +struct T { int t1; long t2; long t3; }; +extern int fn2 (void); +extern int fn3 (struct T); +extern struct T fn4 (); +extern int fn5 (char **, long *, int); +extern void fn6 (void); +extern void fn7 (void *); +struct S *fn10 (); +static int p; +static void *q; +extern struct T r; + +static struct T +fn8 (struct T x, int y) +{ + struct S *u = fn10 (); + int v = fn5 (&u->s1, &u->s2, 0); + while (1) + { + if (p) +fn6 (); + if (fn3 (x)) +return fn4 (); + if (y & 1) +return r; + v = fn5 (&u->s1, &u->s2, 1); + } +} + +struct T +fn9 (struct T x, int y) +{ + struct T t = fn8 (x, y); + if (fn2 ()) + fn7 (q); + return t; +} + +void * +fn1 (void) +{ + return fn9; +} diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr45685.c b/gcc/testsuite/gcc.dg/tree-ssa/pr45685.c new file mode 100644 index 00000000000..06289430fa3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr45685.c @@ -0,0 +1,41 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -fdump-tree-phiopt1-details" } */ + +typedef unsigned long int uint64_t; +typedef long int int64_t; +int summation_helper_1(int64_t* products, uint64_t count) +{ + int s = 0; + uint64_t i; + for(i=0; i<count; i++) + { + int64_t val = (products[i]>0) ? 1 : -1; + products[i] *= val; + if(products[i] != i) + val = -val; + products[i] = val; + s += val; + } + return s; +} + + +int summation_helper_2(int64_t* products, uint64_t count) +{ + int s = 0; + uint64_t i; + for(i=0; i<count; i++) + { + int val = (products[i]>0) ? 1 : -1; + products[i] *= val; + if(products[i] != i) + val = -val; + products[i] = val; + s += val; + } + return s; +} + +/* { dg-final { scan-tree-dump-times "converted to straightline code" 2 "phiopt1" } } */ +/* { dg-final { cleanup-tree-dump "phiopt1" } } */ + diff --git a/gcc/testsuite/gcc.dg/tree-ssa/scev-7.c b/gcc/testsuite/gcc.dg/tree-ssa/scev-7.c new file mode 100644 index 00000000000..d6ceb208258 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/scev-7.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-sccp-scev" } */ + +struct struct_t +{ + int* data; +}; + +void foo (struct struct_t* sp, int start, int end) +{ + int i; + + for (i = 1000; i+start > end; i--) + sp->data[i+start] = 0; +} + +/* { dg-final { scan-tree-dump-times "Simplify PEELED_CHREC into POLYNOMIAL_CHREC" 1 "sccp" } } */ +/* { dg-final { cleanup-tree-dump "sccp" } } */ diff --git a/gcc/testsuite/gcc.dg/tsan/tsan.exp b/gcc/testsuite/gcc.dg/tsan/tsan.exp new file mode 100644 index 00000000000..2bf535a870c --- /dev/null +++ b/gcc/testsuite/gcc.dg/tsan/tsan.exp @@ -0,0 +1,47 @@ +# Copyright (C) 2013 Free Software Foundation, Inc. +# +# This file is part of GCC. +# +# GCC is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GCC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# <http://www.gnu.org/licenses/>. + +# GCC testsuite that uses the `dg.exp' driver. + +# Load support procs. +load_lib gcc-dg.exp +load_lib tsan-dg.exp +load_lib torture-options.exp + +if ![check_effective_target_fthread_sanitizer] { + return +} + +# Initialize `dg'. +dg-init +torture-init +set-torture-options [list \ + { -O0 } \ + { -O2 } ] + +if [tsan_init] { + +# Main loop. +gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c $srcdir/c-c++-common/tsan/*.c]] "" + +} + +# All done. +tsan_finish +torture-finish +dg-finish diff --git a/gcc/testsuite/gcc.dg/vect/pr56787.c b/gcc/testsuite/gcc.dg/vect/pr56787.c index 313d477492f..3f8a07ac291 100644 --- a/gcc/testsuite/gcc.dg/vect/pr56787.c +++ b/gcc/testsuite/gcc.dg/vect/pr56787.c @@ -5,7 +5,7 @@ inline void bar (const float s[5], float z[3][5]) { float a = s[0], b = s[1], c = s[2], d = s[3], e = s[4]; - float f = 1.0f / a; + float f = a; float u = f * b, v = f * c, w = f * d; float p = 0.4f * (e - 0.5f * (b * u + c * v + d * w)); z[0][3] = b * w; diff --git a/gcc/testsuite/gcc.dg/vect/pr58508.c b/gcc/testsuite/gcc.dg/vect/pr58508.c index c4921bb768f..c1ca3347c14 100644 --- a/gcc/testsuite/gcc.dg/vect/pr58508.c +++ b/gcc/testsuite/gcc.dg/vect/pr58508.c @@ -66,5 +66,5 @@ void test5 (int* a, int* b) } } -/* { dg-final { scan-tree-dump-times "hoist" 8 "vect" } } */ +/* { dg-final { scan-tree-dump-times "hoist" 8 "vect" { xfail vect_no_align } } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-nop-move.c b/gcc/testsuite/gcc.dg/vect/vect-nop-move.c new file mode 100644 index 00000000000..92614c6ad72 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-nop-move.c @@ -0,0 +1,65 @@ +/* { dg-do run } */ +/* { dg-require-effective-target vect_float } */ +/* { dg-additional-options "-fdump-rtl-combine-details" } */ + +extern void abort (void); + +#define NOINLINE __attribute__((noinline)) + +typedef float float32x4_t __attribute__ ((__vector_size__ (16))); +typedef float float32x2_t __attribute__ ((__vector_size__ (8))); + +NOINLINE float +foo32x4_be (float32x4_t x) +{ + return x[3]; +} + +NOINLINE float +foo32x4_le (float32x4_t x) +{ + return x[0]; +} + +NOINLINE float +bar (float a) +{ + return a; +} + +NOINLINE float +foo32x2_be (float32x2_t x) +{ + return bar (x[1]); +} + +NOINLINE float +foo32x2_le (float32x2_t x) +{ + return bar (x[0]); +} + +int +main() +{ + float32x4_t a = { 0.0f, 1.0f, 2.0f, 3.0f }; + float32x2_t b = { 0.0f, 1.0f }; + + if (foo32x4_be (a) != 3.0f) + abort (); + + if (foo32x4_le (a) != 0.0f) + abort (); + + if (foo32x2_be (b) != 1.0f) + abort (); + + if (foo32x2_le (b) != 0.0f) + abort (); + + return 0; +} + +/* { dg-final { scan-rtl-dump "deleting noop move" "combine" { target aarch64*-*-* } } } */ +/* { dg-final { cleanup-rtl-dump "combine" } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-3.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-3.c index 06a94168cd0..39f3b6b3b58 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-3.c +++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-3.c @@ -1,4 +1,4 @@ -/* { dg-require-effective-target vect_int } */ +/* { dg-require-effective-target vect_int_mult } */ #include <stdarg.h> #include "tree-vect.h" diff --git a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-10a.c b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-10a.c index 1314039643f..c49473df112 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-10a.c +++ b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-10a.c @@ -15,3 +15,5 @@ bar (int a, int b, long int c) { return a + b + c; } + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-12a.c b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-12a.c index fcd04614e97..c76508f9ac4 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-12a.c +++ b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-12a.c @@ -15,3 +15,5 @@ bar (int a, int b, long int c) { return a + b + c; } + +/* { dg-final { cleanup-tree-dump "vect" } } */ |