diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg')
80 files changed, 1142 insertions, 92 deletions
diff --git a/gcc/testsuite/gcc.dg/Wshadow-compatible-local-1.c b/gcc/testsuite/gcc.dg/Wshadow-compatible-local-1.c new file mode 100644 index 00000000000..ed7b2e45ef1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/Wshadow-compatible-local-1.c @@ -0,0 +1,36 @@ +/* { dg-do compile } */ +/* { dg-options "-Wshadow=compatible-local" } */ + +struct Bar { +}; + +struct Bar bar; /* { dg-bogus "shadowed declaration" } */ + +int val; /* { dg-bogus "shadowed declaration" } */ + +int func1(int x) { /* { dg-bogus "shadowed declaration" } */ + int val; /* { dg-bogus "shadows a global" } */ + val = x; + return val; +} + +int func2(int i) { + int a = 3; /* { dg-message "shadowed declaration" } */ + int j; /* { dg-message "shadowed declaration" } */ + + for (j = 0; j < i; ++j) { + int a = j; /* { dg-warning "shadows a previous local" } */ + int j = a + 1; /* { dg-warning "shadows a previous local" } */ + func1(j); + } + + return a; +} + +void func4() { + struct Bar bar; /* { dg-bogus "shadowed declaration" } */ + if (val) { + int bar; /* { dg-bogus "shadows a previous local" } */ + func1(bar); + } +} diff --git a/gcc/testsuite/gcc.dg/Wshadow-local-1.c b/gcc/testsuite/gcc.dg/Wshadow-local-1.c new file mode 100644 index 00000000000..161f9941fb6 --- /dev/null +++ b/gcc/testsuite/gcc.dg/Wshadow-local-1.c @@ -0,0 +1,22 @@ +/* { dg-do compile } */ +/* { dg-options "-Wshadow=local" } */ + +int decl1; /* should not warn */ +void foo (double decl1) /* should not warn */ +{ +} + +void foo2 (int d) /* { dg-message "shadowed declaration" } */ +{ + { + double d; /* { dg-warning "shadows a parameter" } */ + } +} + +void foo3 () +{ + int local; /* { dg-message "shadowed declaration" } */ + { + int local; /* { dg-warning "shadows a previous local" } */ + } +} diff --git a/gcc/testsuite/gcc.dg/Wshadow-local-2.c b/gcc/testsuite/gcc.dg/Wshadow-local-2.c new file mode 100644 index 00000000000..8f6b132f66d --- /dev/null +++ b/gcc/testsuite/gcc.dg/Wshadow-local-2.c @@ -0,0 +1,49 @@ +/* { dg-do compile } */ +/* { dg-options "-Wshadow=local" } */ + +struct Bar { +}; + +struct Bar bar; /* { dg-bogus "shadowed declaration" } */ + +int val; /* { dg-bogus "shadowed declaration" } */ + +int func1(int x) { /* { dg-bogus "shadowed declaration" } */ + int val; /* { dg-bogus "shadows a global" } */ + val = x; + return val; +} + +int func2(int i) { + int a = 3; /* { dg-message "shadowed declaration" } */ + int j; /* { dg-message "shadowed declaration" } */ + + for (j = 0; j < i; ++j) { + int a = j; /* { dg-warning "shadows a previous local" } */ + int j = a + 1; /* { dg-warning "shadows a previous local" } */ + func1(j); + } + + return a; +} + +int func3() { + int bar; /* { dg-bogus "shadows a global" } */ + float func1 = 0.3; /* { dg-bogus "shadows a global" } */ + + if (func1 > 1) + bar = 2; + else + bar = 1; + return bar; +} + +void func4() { + struct Bar bar; /* { dg-message "shadowed declaration" } */ + if (val) { + int bar; /* { dg-warning "shadows a previous local" } */ + func1(bar); + } +} + +/* { dg-bogus "shadows a global" "" { target *-*-* } 42 } */ diff --git a/gcc/testsuite/gcc.dg/Wshadow-local-3.c b/gcc/testsuite/gcc.dg/Wshadow-local-3.c new file mode 100644 index 00000000000..429df37f541 --- /dev/null +++ b/gcc/testsuite/gcc.dg/Wshadow-local-3.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-options "-Wno-shadow" } */ + +void func() { + int i; + { + int i; /* should not warn */ + } +} diff --git a/gcc/testsuite/gcc.dg/Wtrampolines.c b/gcc/testsuite/gcc.dg/Wtrampolines.c index 62b782a8bf0..e2e9cd4c8fd 100644 --- a/gcc/testsuite/gcc.dg/Wtrampolines.c +++ b/gcc/testsuite/gcc.dg/Wtrampolines.c @@ -28,7 +28,7 @@ void foo (void) double a (int k, pfun x1, pfun x2, pfun x3, pfun x4, pfun x5) { - double b (void) /* { dg-warning "trampoline generated for nested function 'b'" "standard descriptors" { xfail ia64-*-* powerpc64-*-* } } */ + double b (void) /* { dg-warning "trampoline generated for nested function 'b'" "standard descriptors" { xfail ia64-*-* powerpc64-*-* *-*-aix* } } */ { k = k - 1; return a (k, b, x1, x2, x3, x4 ); diff --git a/gcc/testsuite/gcc.dg/addr_equal-1.c b/gcc/testsuite/gcc.dg/addr_equal-1.c index 94499f067b4..dd237a7d3cd 100644 --- a/gcc/testsuite/gcc.dg/addr_equal-1.c +++ b/gcc/testsuite/gcc.dg/addr_equal-1.c @@ -3,6 +3,7 @@ /* { dg-require-weak "" } */ /* { dg-require-alias "" } */ /* { dg-options "-O2" } */ +/* { dg-skip-if "" { powerpc-ibm-aix* } } */ void abort (void); extern int undef_var0, undef_var1; extern __attribute__ ((weak)) int weak_undef_var0; diff --git a/gcc/testsuite/gcc.dg/asan/use-after-scope-1.c b/gcc/testsuite/gcc.dg/asan/use-after-scope-1.c new file mode 100644 index 00000000000..bdbc97becae --- /dev/null +++ b/gcc/testsuite/gcc.dg/asan/use-after-scope-1.c @@ -0,0 +1,18 @@ +// { dg-do run } +// { dg-shouldfail "asan" } + +int +main (void) +{ + char *ptr; + { + char my_char[9]; + ptr = &my_char[0]; + } + + return *(ptr+8); +} + +// { dg-output "ERROR: AddressSanitizer: stack-use-after-scope on address.*(\n|\r\n|\r)" } +// { dg-output "READ of size 1 at.*" } +// { dg-output ".*'my_char' <== Memory access at offset \[0-9\]* is inside this variable.*" } diff --git a/gcc/testsuite/gcc.dg/asan/use-after-scope-2.c b/gcc/testsuite/gcc.dg/asan/use-after-scope-2.c new file mode 100644 index 00000000000..dedb73400cd --- /dev/null +++ b/gcc/testsuite/gcc.dg/asan/use-after-scope-2.c @@ -0,0 +1,47 @@ +// { dg-do run } +// { dg-shouldfail "asan" } + +int *bar (int *x, int *y) { return y; } + +int foo (void) +{ + char *p; + { + char a = 0; + p = &a; + } + + if (*p) + return 1; + else + return 0; +} + +int +main (void) +{ + char *ptr; + { + char my_char[9]; + ptr = &my_char[0]; + } + + int a[16]; + int *p, *q = a; + { + int b[16]; + p = bar (a, b); + } + bar (a, q); + { + int c[16]; + q = bar (a, c); + } + int v = *bar (a, q); + return v; +} + + +// { dg-output "ERROR: AddressSanitizer: stack-use-after-scope on address.*(\n|\r\n|\r)" } +// { dg-output "READ of size 4 at.*" } +// { dg-output ".*'c' <== Memory access at offset \[0-9\]* is inside this variable.*" } diff --git a/gcc/testsuite/gcc.dg/asan/use-after-scope-3.c b/gcc/testsuite/gcc.dg/asan/use-after-scope-3.c new file mode 100644 index 00000000000..9aeed51a770 --- /dev/null +++ b/gcc/testsuite/gcc.dg/asan/use-after-scope-3.c @@ -0,0 +1,20 @@ +// { dg-do run } +// { dg-shouldfail "asan" } + +int +main (void) +{ + char *ptr; + char *ptr2; + { + char my_char[9]; + ptr = &my_char[0]; + __builtin_memcpy (&ptr2, &ptr, sizeof (ptr2)); + } + + *(ptr2+9) = 'c'; +} + +// { dg-output "ERROR: AddressSanitizer: stack-use-after-scope on address.*(\n|\r\n|\r)" } +// { dg-output "WRITE of size 1 at.*" } +// { dg-output ".*'my_char' <== Memory access at offset \[0-9\]* overflows this variable.*" } diff --git a/gcc/testsuite/gcc.dg/asan/use-after-scope-4.c b/gcc/testsuite/gcc.dg/asan/use-after-scope-4.c new file mode 100644 index 00000000000..77d7052bd19 --- /dev/null +++ b/gcc/testsuite/gcc.dg/asan/use-after-scope-4.c @@ -0,0 +1,16 @@ +// { dg-do run } + +int +__attribute__((no_sanitize_address)) +main (void) +{ + char *ptr; + char *ptr2; + { + char my_char[9]; + ptr = &my_char[0]; + __builtin_memcpy (&ptr2, &ptr, sizeof (ptr2)); + } + + *(ptr2+9) = 'c'; +} diff --git a/gcc/testsuite/gcc.dg/asan/use-after-scope-5.c b/gcc/testsuite/gcc.dg/asan/use-after-scope-5.c new file mode 100644 index 00000000000..b53712daa34 --- /dev/null +++ b/gcc/testsuite/gcc.dg/asan/use-after-scope-5.c @@ -0,0 +1,27 @@ +// { dg-do run } +// { dg-shouldfail "asan" } + +int *ptr; + +__attribute__((always_inline)) +inline static void +foo(int v) +{ + int values[10]; + for (unsigned i = 0; i < 10; i++) + values[i] = v; + + ptr = &values[3]; +} + +int +main (int argc, char **argv) +{ + foo (argc); + + return *ptr; +} + +// { dg-output "ERROR: AddressSanitizer: stack-use-after-scope on address.*(\n|\r\n|\r)" } +// { dg-output "READ of size 4 at.*" } +// { dg-output ".*'values' <== Memory access at offset \[0-9\]* is inside this variable.*" } diff --git a/gcc/testsuite/gcc.dg/asan/use-after-scope-6.c b/gcc/testsuite/gcc.dg/asan/use-after-scope-6.c new file mode 100644 index 00000000000..bb13cecbd1a --- /dev/null +++ b/gcc/testsuite/gcc.dg/asan/use-after-scope-6.c @@ -0,0 +1,15 @@ +// { dg-do run } +// { dg-additional-options "--param asan-stack=0" } + +int +main (void) +{ + char *ptr; + { + char my_char[9]; + ptr = &my_char[0]; + } + + *ptr = 'c'; + return 0; +} diff --git a/gcc/testsuite/gcc.dg/asan/use-after-scope-7.c b/gcc/testsuite/gcc.dg/asan/use-after-scope-7.c new file mode 100644 index 00000000000..41152059160 --- /dev/null +++ b/gcc/testsuite/gcc.dg/asan/use-after-scope-7.c @@ -0,0 +1,15 @@ +// { dg-do run } +// { dg-additional-options "-fno-sanitize-address-use-after-scope" } + +int +main (void) +{ + char *ptr; + { + char my_char[9]; + ptr = &my_char[0]; + } + + *ptr = 'c'; + return 0; +} diff --git a/gcc/testsuite/gcc.dg/asan/use-after-scope-9.c b/gcc/testsuite/gcc.dg/asan/use-after-scope-9.c new file mode 100644 index 00000000000..2e30deffa18 --- /dev/null +++ b/gcc/testsuite/gcc.dg/asan/use-after-scope-9.c @@ -0,0 +1,20 @@ +// { dg-do run } +// { dg-shouldfail "asan" } + +int +main (int argc, char **argv) +{ + int *ptr = 0; + + { + int a; + ptr = &a; + *ptr = 12345; + } + + return *ptr; +} + +// { dg-output "ERROR: AddressSanitizer: stack-use-after-scope on address.*(\n|\r\n|\r)" } +// { dg-output "READ of size .*" } +// { dg-output ".*'a' <== Memory access at offset \[0-9\]* is inside this variable.*" } diff --git a/gcc/testsuite/gcc.dg/asan/use-after-scope-goto-1.c b/gcc/testsuite/gcc.dg/asan/use-after-scope-goto-1.c new file mode 100644 index 00000000000..c47a5e8db02 --- /dev/null +++ b/gcc/testsuite/gcc.dg/asan/use-after-scope-goto-1.c @@ -0,0 +1,47 @@ +// { dg-do run } +// { dg-additional-options "-fdump-tree-asan0" } +/* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */ + +int main(int argc, char **argv) +{ + int a = 123; + int b = 123; + int c = 123; + int d = 123; + int e = 123; + int f = 123; + + if (argc == 0) + { + int *ptr; + int *ptr2; + int *ptr3; + int *ptr4; + int *ptr5; + int *ptr6; + label: + { + ptr = &a; + *ptr = 1; + ptr2 = &b; + *ptr2 = 1; + ptr3 = &c; + *ptr3 = 1; + ptr4 = &d; + *ptr4 = 1; + ptr5 = &e; + *ptr5 = 1; + ptr6 = &f; + *ptr6 = 1; + return 0; + } + } + else + goto label; + + return 0; +} + +/* { dg-final { scan-tree-dump-times "ASAN_MARK \\(2, &a, 4\\);" 2 "asan0" } } */ +/* { dg-final { scan-tree-dump-times "ASAN_MARK \\(2, &c, 4\\);" 2 "asan0" } } */ +/* { dg-final { scan-tree-dump-times "ASAN_MARK \\(2, &e, 4\\);" 2 "asan0" } } */ diff --git a/gcc/testsuite/gcc.dg/asan/use-after-scope-goto-2.c b/gcc/testsuite/gcc.dg/asan/use-after-scope-goto-2.c new file mode 100644 index 00000000000..73ef4e0eb1e --- /dev/null +++ b/gcc/testsuite/gcc.dg/asan/use-after-scope-goto-2.c @@ -0,0 +1,25 @@ +// { dg-do run } +// { dg-additional-options "-fdump-tree-asan0" } +/* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */ + +int main(int argc, char **argv) +{ + int a = 123; + + if (argc == 0) + { + int *ptr; + /* The label is not used in &label or goto label. Thus '&a' should be + marked just once. */ + label: + { + ptr = &a; + *ptr = 1; + return 0; + } + } + + return 0; +} + +/* { dg-final { scan-tree-dump-times "ASAN_MARK \\(2, &a, 4\\);" 1 "asan0" } } */ diff --git a/gcc/testsuite/gcc.dg/asan/use-after-scope-switch-1.c b/gcc/testsuite/gcc.dg/asan/use-after-scope-switch-1.c new file mode 100644 index 00000000000..a8342686d4e --- /dev/null +++ b/gcc/testsuite/gcc.dg/asan/use-after-scope-switch-1.c @@ -0,0 +1,25 @@ +// { dg-do run } +// { dg-additional-options "-fdump-tree-gimple" } + +int +main (int argc, char **argv) +{ + int *ptr = 0; + + for (unsigned i = 0; i < 2; i++) + { + switch (argc) + { + int a; + default: + ptr = &a; + *ptr = 12345; + break; + } + } + + return 0; +} + +/* { dg-final { scan-tree-dump-times "ASAN_MARK \\(2, &a, \[0-9\]\\);" 2 "gimple" } } */ +/* { dg-final { scan-tree-dump-times "ASAN_MARK \\(1, &a, \[0-9\]\\);" 1 "gimple" } } */ diff --git a/gcc/testsuite/gcc.dg/asan/use-after-scope-switch-2.c b/gcc/testsuite/gcc.dg/asan/use-after-scope-switch-2.c new file mode 100644 index 00000000000..8aeca5a3b7a --- /dev/null +++ b/gcc/testsuite/gcc.dg/asan/use-after-scope-switch-2.c @@ -0,0 +1,33 @@ +// { dg-do run } +// { dg-additional-options "-fdump-tree-gimple" } + +int +main (int argc, char **argv) +{ + int *ptr = 0; + int *ptr2 = 0; + int *ptr3 = 0; + + for (unsigned i = 0; i < 2; i++) + { + switch (argc) + { + case 1111:; + int a, b, c; + default: + ptr = &a; + ptr2 = &b; + ptr3 = &c; + break; + } + } + + return 0; +} + +/* { dg-final { scan-tree-dump-times "ASAN_MARK \\(2, &a, \[0-9\]\\);" 2 "gimple" } } */ +/* { dg-final { scan-tree-dump-times "ASAN_MARK \\(2, &b, \[0-9\]\\);" 2 "gimple" } } */ +/* { dg-final { scan-tree-dump-times "ASAN_MARK \\(2, &c, \[0-9\]\\);" 2 "gimple" } } */ +/* { dg-final { scan-tree-dump-times "ASAN_MARK \\(1, &a, \[0-9\]\\);" 1 "gimple" } } */ +/* { dg-final { scan-tree-dump-times "ASAN_MARK \\(1, &b, \[0-9\]\\);" 1 "gimple" } } */ +/* { dg-final { scan-tree-dump-times "ASAN_MARK \\(1, &c, \[0-9\]\\);" 1 "gimple" } } */ diff --git a/gcc/testsuite/gcc.dg/asan/use-after-scope-switch-3.c b/gcc/testsuite/gcc.dg/asan/use-after-scope-switch-3.c new file mode 100644 index 00000000000..828cb7c3b2a --- /dev/null +++ b/gcc/testsuite/gcc.dg/asan/use-after-scope-switch-3.c @@ -0,0 +1,36 @@ +// { dg-do run } +// { dg-additional-options "-fdump-tree-gimple" } + +int +main (int argc, char **argv) +{ + int *ptr = 0; + + for (unsigned i = 0; i < 2; i++) + { + switch (argc) + { + case 11111:; + int a; + ptr = &a; + break; + { + default: + ptr = &a; + *ptr = 12345; + case 222222: + my_label: + ptr = &a; + break; + } + } + } + + if (argc == 333333) + goto my_label; + + return 0; +} + +/* { dg-final { scan-tree-dump-times "ASAN_MARK \\(2, &a, \[0-9\]\\);" 4 "gimple" } } */ +/* { dg-final { scan-tree-dump-times "ASAN_MARK \\(1, &a, \[0-9\]\\);" 1 "gimple" } } */ diff --git a/gcc/testsuite/gcc.dg/cpp/trad/include.c b/gcc/testsuite/gcc.dg/cpp/trad/include.c index 94d25f815c6..967476d3a1f 100644 --- a/gcc/testsuite/gcc.dg/cpp/trad/include.c +++ b/gcc/testsuite/gcc.dg/cpp/trad/include.c @@ -2,11 +2,5 @@ /* Test that macros are not expanded in the <> quotes of #inlcude. */ -/* vxWorksCommon.h uses the "#" operator to construct the name of an - include file, thus making the file incompatible with -traditional-cpp. - Newlib uses ## when including stdlib.h as of 2007-09-07. */ -/* { dg-do preprocess { target { { ! vxworks_kernel } && { ! newlib } } } } */ - -#define __STDC__ 1 /* Stop complaints about non-ISO compilers. */ -#define stdlib 1 -#include <stdlib.h> /* { dg-bogus "o such file or directory" } */ +#define builtins 1 +#include <builtins.h> /* { dg-bogus "o such file or directory" } */ diff --git a/gcc/testsuite/gcc.dg/cpp/trad/trad.exp b/gcc/testsuite/gcc.dg/cpp/trad/trad.exp index 5f090ac54a0..01e1400b3c3 100644 --- a/gcc/testsuite/gcc.dg/cpp/trad/trad.exp +++ b/gcc/testsuite/gcc.dg/cpp/trad/trad.exp @@ -37,7 +37,7 @@ dg-init # Main loop. dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] \ - "" $DEFAULT_TRADCPPFLAGS + "-I$srcdir/$subdir/" $DEFAULT_TRADCPPFLAGS # All done. dg-finish diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/pr71855.c b/gcc/testsuite/gcc.dg/debug/dwarf2/pr71855.c index 4fd8b74f329..3842dbc0270 100644 --- a/gcc/testsuite/gcc.dg/debug/dwarf2/pr71855.c +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/pr71855.c @@ -8,4 +8,4 @@ foo (const char *format, ...) { } -// { dg-final { scan-assembler-times "DIE.*DW_TAG_unspecified_parameters" 1 } } +// { dg-final { scan-assembler-times "DIE.*DW_TAG_unspecified_parameters" 1 { xfail { powerpc-ibm-aix* } } } } diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/prod-options.c b/gcc/testsuite/gcc.dg/debug/dwarf2/prod-options.c index e6bc1371f26..6577eff3548 100644 --- a/gcc/testsuite/gcc.dg/debug/dwarf2/prod-options.c +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/prod-options.c @@ -4,7 +4,7 @@ as well. */ /* { dg-do compile } */ /* { dg-options "-O2 -gdwarf -dA -fdebug-prefix-map=a=b" } */ -/* { dg-final { scan-assembler "DW_AT_producer: \"GNU C" { target { { { ! *-*-solaris2* } || gas } && { ! hppa*64*-*-* } } } } } */ +/* { dg-final { scan-assembler "DW_AT_producer: \"GNU C" { target { { { ! *-*-solaris2* } || gas } && { { ! hppa*64*-*-* } && { ! powerpc-ibm-aix* } } } } } } */ /* { dg-final { scan-assembler "\"GNU C\[^\\n\\r\]+ DW_AT_producer" { target { { *-*-solaris2* && { ! gas } } || { hppa*64*-*-* } } } } } */ /* { dg-final { scan-assembler-not "debug-prefix-map" } } */ diff --git a/gcc/testsuite/gcc.dg/divmod-1-simode.c b/gcc/testsuite/gcc.dg/divmod-1-simode.c new file mode 100644 index 00000000000..9e477997bcf --- /dev/null +++ b/gcc/testsuite/gcc.dg/divmod-1-simode.c @@ -0,0 +1,25 @@ +/* { dg-require-effective-target divmod_simode } */ +/* { dg-options "-O2 -fdump-tree-widening_mul-details" } */ +/* div dominates mod. */ + +typedef int SImode __attribute__((mode(SI))); +typedef unsigned USImode __attribute__((mode(SI))); + +extern int cond; +void foo(void); + +#define FOO(smalltype, bigtype, no) \ +bigtype f_##no(smalltype x, bigtype y) \ +{ \ + bigtype q = x / y; \ + if (cond) \ + foo (); \ + bigtype r = x % y; \ + return q + r; \ +} + +FOO(SImode, SImode, 1) +FOO(SImode, USImode, 2) +FOO(USImode, USImode, 3) + +/* { dg-final { scan-tree-dump-times "DIVMOD" 3 "widening_mul" } } */ diff --git a/gcc/testsuite/gcc.dg/divmod-1.c b/gcc/testsuite/gcc.dg/divmod-1.c new file mode 100644 index 00000000000..edcc2a107da --- /dev/null +++ b/gcc/testsuite/gcc.dg/divmod-1.c @@ -0,0 +1,32 @@ +/* { dg-require-effective-target divmod } */ +/* { dg-options "-O2 -fdump-tree-widening_mul-details" } */ +/* div dominates mod. */ + +typedef int SImode __attribute__((mode(SI))); +typedef unsigned USImode __attribute__((mode(SI))); + +typedef int DImode __attribute__((mode(DI))); +typedef unsigned UDImode __attribute__((mode(DI))); + +extern int cond; +void foo(void); + +#define FOO(smalltype, bigtype, no) \ +bigtype f_##no(smalltype x, bigtype y) \ +{ \ + bigtype q = x / y; \ + if (cond) \ + foo (); \ + bigtype r = x % y; \ + return q + r; \ +} + +FOO(SImode, DImode, 1) +FOO(SImode, UDImode, 2) +FOO(USImode, DImode, 3) +FOO(USImode, UDImode, 4) +FOO(DImode, DImode, 5) +FOO(DImode, UDImode, 6) +FOO(UDImode, UDImode, 7) + +/* { dg-final { scan-tree-dump-times "DIVMOD" 7 "widening_mul" } } */ diff --git a/gcc/testsuite/gcc.dg/divmod-2-simode.c b/gcc/testsuite/gcc.dg/divmod-2-simode.c new file mode 100644 index 00000000000..fa28beb3cef --- /dev/null +++ b/gcc/testsuite/gcc.dg/divmod-2-simode.c @@ -0,0 +1,25 @@ +/* { dg-require-effective-target divmod_simode } */ +/* { dg-options "-O2 -fdump-tree-widening_mul-details" } */ +/* mod dominates div. */ + +typedef int SImode __attribute__((mode(SI))); +typedef unsigned USImode __attribute__((mode(SI))); + +extern int cond; +void foo(void); + +#define FOO(smalltype, bigtype, no) \ +bigtype f_##no(smalltype x, bigtype y) \ +{ \ + bigtype r = x % y; \ + if (cond) \ + foo (); \ + bigtype q = x / y; \ + return q + r; \ +} + +FOO(SImode, SImode, 1) +FOO(SImode, USImode, 2) +FOO(USImode, USImode, 3) + +/* { dg-final { scan-tree-dump-times "DIVMOD" 3 "widening_mul" } } */ diff --git a/gcc/testsuite/gcc.dg/divmod-2.c b/gcc/testsuite/gcc.dg/divmod-2.c new file mode 100644 index 00000000000..ded732e121d --- /dev/null +++ b/gcc/testsuite/gcc.dg/divmod-2.c @@ -0,0 +1,32 @@ +/* { dg-require-effective-target divmod } */ +/* { dg-options "-O2 -fdump-tree-widening_mul-details" } */ +/* mod dominates div. */ + +typedef int SImode __attribute__((mode(SI))); +typedef unsigned USImode __attribute__((mode(SI))); + +typedef int DImode __attribute__((mode(DI))); +typedef unsigned UDImode __attribute__((mode(DI))); + +extern int cond; +void foo(void); + +#define FOO(smalltype, bigtype, no) \ +bigtype f_##no(smalltype x, bigtype y) \ +{ \ + bigtype r = x % y; \ + if (cond) \ + foo (); \ + bigtype q = x / y; \ + return q + r; \ +} + +FOO(SImode, DImode, 1) +FOO(SImode, UDImode, 2) +FOO(USImode, DImode, 3) +FOO(USImode, UDImode, 4) +FOO(DImode, DImode, 5) +FOO(DImode, UDImode, 6) +FOO(UDImode, UDImode, 7) + +/* { dg-final { scan-tree-dump-times "DIVMOD" 7 "widening_mul" } } */ diff --git a/gcc/testsuite/gcc.dg/divmod-3-simode.c b/gcc/testsuite/gcc.dg/divmod-3-simode.c new file mode 100644 index 00000000000..9dee5bf603b --- /dev/null +++ b/gcc/testsuite/gcc.dg/divmod-3-simode.c @@ -0,0 +1,23 @@ +/* { dg-require-effective-target divmod_simode } */ +/* { dg-options "-O2 -fdump-tree-widening_mul-details" } */ +/* div comes before mod in same bb. */ + +typedef int SImode __attribute__((mode(SI))); +typedef unsigned USImode __attribute__((mode(SI))); + +extern int cond; +void foo(void); + +#define FOO(smalltype, bigtype, no) \ +bigtype f_##no(smalltype x, bigtype y) \ +{ \ + bigtype q = x / y; \ + bigtype r = x % y; \ + return q + r; \ +} + +FOO(SImode, SImode, 1) +FOO(SImode, USImode, 2) +FOO(USImode, USImode, 3) + +/* { dg-final { scan-tree-dump-times "DIVMOD" 3 "widening_mul" } } */ diff --git a/gcc/testsuite/gcc.dg/divmod-3.c b/gcc/testsuite/gcc.dg/divmod-3.c new file mode 100644 index 00000000000..02aa367ac6e --- /dev/null +++ b/gcc/testsuite/gcc.dg/divmod-3.c @@ -0,0 +1,30 @@ +/* { dg-require-effective-target divmod } */ +/* { dg-options "-O2 -fdump-tree-widening_mul-details" } */ +/* div comes before mod in same bb. */ + +typedef int SImode __attribute__((mode(SI))); +typedef unsigned USImode __attribute__((mode(SI))); + +typedef int DImode __attribute__((mode(DI))); +typedef unsigned UDImode __attribute__((mode(DI))); + +extern int cond; +void foo(void); + +#define FOO(smalltype, bigtype, no) \ +bigtype f_##no(smalltype x, bigtype y) \ +{ \ + bigtype q = x / y; \ + bigtype r = x % y; \ + return q + r; \ +} + +FOO(SImode, DImode, 1) +FOO(SImode, UDImode, 2) +FOO(USImode, DImode, 3) +FOO(USImode, UDImode, 4) +FOO(DImode, DImode, 5) +FOO(DImode, UDImode, 6) +FOO(UDImode, UDImode, 7) + +/* { dg-final { scan-tree-dump-times "DIVMOD" 7 "widening_mul" } } */ diff --git a/gcc/testsuite/gcc.dg/divmod-4-simode.c b/gcc/testsuite/gcc.dg/divmod-4-simode.c new file mode 100644 index 00000000000..dbe29cb761d --- /dev/null +++ b/gcc/testsuite/gcc.dg/divmod-4-simode.c @@ -0,0 +1,23 @@ +/* { dg-require-effective-target divmod_simode } */ +/* { dg-options "-O2 -fdump-tree-widening_mul-details" } */ +/* mod comes before div in same bb. */ + +typedef int SImode __attribute__((mode(SI))); +typedef unsigned USImode __attribute__((mode(SI))); + +extern int cond; +void foo(void); + +#define FOO(smalltype, bigtype, no) \ +bigtype f_##no(smalltype x, bigtype y) \ +{ \ + bigtype r = x % y; \ + bigtype q = x / y; \ + return q + r; \ +} + +FOO(SImode, SImode, 1) +FOO(SImode, USImode, 2) +FOO(USImode, USImode, 3) + +/* { dg-final { scan-tree-dump-times "DIVMOD" 3 "widening_mul" } } */ diff --git a/gcc/testsuite/gcc.dg/divmod-4.c b/gcc/testsuite/gcc.dg/divmod-4.c new file mode 100644 index 00000000000..861ecbdec4b --- /dev/null +++ b/gcc/testsuite/gcc.dg/divmod-4.c @@ -0,0 +1,30 @@ +/* { dg-require-effective-target divmod } */ +/* { dg-options "-O2 -fdump-tree-widening_mul-details" } */ +/* mod comes before div in same bb. */ + +typedef int SImode __attribute__((mode(SI))); +typedef unsigned USImode __attribute__((mode(SI))); + +typedef int DImode __attribute__((mode(DI))); +typedef unsigned UDImode __attribute__((mode(DI))); + +extern int cond; +void foo(void); + +#define FOO(smalltype, bigtype, no) \ +bigtype f_##no(smalltype x, bigtype y) \ +{ \ + bigtype r = x % y; \ + bigtype q = x / y; \ + return q + r; \ +} + +FOO(SImode, DImode, 3) +FOO(SImode, UDImode, 4) +FOO(USImode, DImode, 6) +FOO(USImode, UDImode, 7) +FOO(DImode, DImode, 8) +FOO(DImode, UDImode, 9) +FOO(UDImode, UDImode, 10) + +/* { dg-final { scan-tree-dump-times "DIVMOD" 7 "widening_mul" } } */ diff --git a/gcc/testsuite/gcc.dg/divmod-5.c b/gcc/testsuite/gcc.dg/divmod-5.c new file mode 100644 index 00000000000..8a8cee50ae2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/divmod-5.c @@ -0,0 +1,19 @@ +/* { dg-require-effective-target divmod_simode } */ +/* { dg-options "-O2 -fdump-tree-widening_mul-details" } */ +/* div and mod are not in same bb and + bb's containing div and mod don't dominate each other. */ + +int f(int x, int y) +{ + int q = 0; + int r = 0; + extern int cond; + + if (cond) + q = x / y; + + r = x % y; + return q + r; +} + +/* { dg-final { scan-tree-dump-times "DIVMOD" 0 "widening_mul" } } */ diff --git a/gcc/testsuite/gcc.dg/divmod-6-simode.c b/gcc/testsuite/gcc.dg/divmod-6-simode.c new file mode 100644 index 00000000000..1107f760b42 --- /dev/null +++ b/gcc/testsuite/gcc.dg/divmod-6-simode.c @@ -0,0 +1,26 @@ +/* { dg-require-effective-target divmod_simode } */ +/* { dg-options "-O2 -fdump-tree-widening_mul-details" } */ + +typedef int SImode __attribute__((mode(SI))); +typedef unsigned USImode __attribute__((mode(SI))); + +extern int cond; +void foo(void); + +#define FOO(smalltype, bigtype, no) \ +bigtype f_##no(smalltype x, bigtype y) \ +{ \ + bigtype q = x / y; \ + bigtype r1 = 0, r2 = 0; \ + if (cond) \ + r1 = x % y; \ + else \ + r2 = x % y; \ + return q + r1 + r2; \ +} + +FOO(SImode, SImode, 1) +FOO(SImode, USImode, 2) +FOO(USImode, USImode, 3) + +/* { dg-final { scan-tree-dump-times "DIVMOD" 3 "widening_mul" } } */ diff --git a/gcc/testsuite/gcc.dg/divmod-6.c b/gcc/testsuite/gcc.dg/divmod-6.c new file mode 100644 index 00000000000..495ebaff805 --- /dev/null +++ b/gcc/testsuite/gcc.dg/divmod-6.c @@ -0,0 +1,33 @@ +/* { dg-require-effective-target divmod } */ +/* { dg-options "-O2 -fdump-tree-widening_mul-details" } */ + +typedef int SImode __attribute__((mode(SI))); +typedef unsigned USImode __attribute__((mode(SI))); + +typedef int DImode __attribute__((mode(DI))); +typedef unsigned UDImode __attribute__((mode(DI))); + +extern int cond; +void foo(void); + +#define FOO(smalltype, bigtype, no) \ +bigtype f_##no(smalltype x, bigtype y) \ +{ \ + bigtype q = x / y; \ + bigtype r1 = 0, r2 = 0; \ + if (cond) \ + r1 = x % y; \ + else \ + r2 = x % y; \ + return q + r1 + r2; \ +} + +FOO(SImode, DImode, 3) +FOO(SImode, UDImode, 4) +FOO(USImode, DImode, 6) +FOO(USImode, UDImode, 7) +FOO(DImode, DImode, 8) +FOO(DImode, UDImode, 9) +FOO(UDImode, UDImode, 10) + +/* { dg-final { scan-tree-dump-times "DIVMOD" 7 "widening_mul" } } */ diff --git a/gcc/testsuite/gcc.dg/divmod-7.c b/gcc/testsuite/gcc.dg/divmod-7.c new file mode 100644 index 00000000000..faa90b3ac8f --- /dev/null +++ b/gcc/testsuite/gcc.dg/divmod-7.c @@ -0,0 +1,21 @@ +/* { dg-require-effective-target divmod_simode } */ +/* { dg-options "-O2 -fdump-tree-widening_mul-details" } */ + +int f(int x, int y) +{ + int q = 0, r1 = 0, r2 = 0; + extern int cond; + + if (cond) + q = x / y; + else + { + r1 = x % y; + return q + r1; + } + + r2 = x % y; + return q + r2; +} + +/* { dg-final { scan-tree-dump-times "DIVMOD" 1 "widening_mul" } } */ diff --git a/gcc/testsuite/gcc.dg/ipa/pr78121.c b/gcc/testsuite/gcc.dg/ipa/pr78121.c new file mode 100644 index 00000000000..4a0ae187256 --- /dev/null +++ b/gcc/testsuite/gcc.dg/ipa/pr78121.c @@ -0,0 +1,16 @@ +/* PR ipa/78121 */ +/* { dg-do compile } */ +/* { dg-options "-ansi -O2 -fdump-ipa-cp-details" } */ + +void fn2 (unsigned char c); +int a; +static void fn1(c) unsigned char c; +{ + if (a) + fn2 (c); + fn1('#'); +} + +void fn3() { fn1 (267); } + +/* { dg-final { scan-ipa-dump-times "Setting value range of param 0 \\\[11, 35\\\]" 1 "cp" } } */ diff --git a/gcc/testsuite/gcc.dg/ipa/vrp7.c b/gcc/testsuite/gcc.dg/ipa/vrp7.c new file mode 100644 index 00000000000..e4e0bc66a64 --- /dev/null +++ b/gcc/testsuite/gcc.dg/ipa/vrp7.c @@ -0,0 +1,32 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-ipa-cp-details" } */ + +volatile int cond; +int abs (int); + +static __attribute__((noinline, noclone)) +int foo (int i) +{ + if (i < 5) + __builtin_abort (); + return 0; +} + +static __attribute__((noinline, noclone)) +int bar (int j) +{ + foo (~j); + foo (abs (j)); + foo (j); + return 0; +} + +int main () +{ + for (unsigned int i = 0; i < 10; ++i) + bar (i); + + return 0; +} + +/* { dg-final { scan-ipa-dump-times "Setting value range of param 0 \\\[-10, 9\\\]" 1 "cp" } } */ diff --git a/gcc/testsuite/gcc.dg/lto/pr60449_0.c b/gcc/testsuite/gcc.dg/lto/pr60449_0.c index a430830cbed..5b878a640db 100644 --- a/gcc/testsuite/gcc.dg/lto/pr60449_0.c +++ b/gcc/testsuite/gcc.dg/lto/pr60449_0.c @@ -1,4 +1,5 @@ /* { dg-lto-do link } */ +/* { dg-skip-if "Needs gettimeofday" { "avr-*-*" } } */ extern int printf (const char *__restrict __format, ...); typedef long int __time_t; diff --git a/gcc/testsuite/gcc.dg/no_profile_instrument_function-attr-1.c b/gcc/testsuite/gcc.dg/no_profile_instrument_function-attr-1.c index c93d1718b64..e0c2600b400 100644 --- a/gcc/testsuite/gcc.dg/no_profile_instrument_function-attr-1.c +++ b/gcc/testsuite/gcc.dg/no_profile_instrument_function-attr-1.c @@ -19,5 +19,5 @@ int main () /* { dg-final { scan-tree-dump-times "__gcov0\\.main.* = PROF_edge_counter" 1 "optimized"} } */ /* { dg-final { scan-tree-dump-times "__gcov_indirect_call_profiler_v2" 1 "optimized" } } */ -/* { dg-final { scan-tree-dump-times "__gcov_time_profiler" 1 "optimized" } } */ +/* { dg-final { scan-tree-dump-times "__gcov_time_profiler_counter = " 1 "optimized" } } */ /* { dg-final { scan-tree-dump-times "__gcov_init" 1 "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/pr35691-1.c b/gcc/testsuite/gcc.dg/pr35691-1.c new file mode 100644 index 00000000000..125923dd24c --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr35691-1.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-forwprop-details" } */ + +int foo(int z0, unsigned z1) +{ + int t0 = (z0 == 0); + int t1 = (z1 == 0); + int t2 = (t0 & t1); + return t2; +} + +/* { dg-final { scan-tree-dump "gimple_simplified to _\[0-9\]* = \\(int\\) z1_\[0-9\]*\\(D\\);" "forwprop1" } } */ diff --git a/gcc/testsuite/gcc.dg/pr35691-2.c b/gcc/testsuite/gcc.dg/pr35691-2.c new file mode 100644 index 00000000000..70f68a685d7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr35691-2.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-forwprop-details" } */ + +int foo(int z0, unsigned z1) +{ + int t0 = (z0 != 0); + int t1 = (z1 != 0); + int t2 = (t0 | t1); + return t2; +} + +/* { dg-final { scan-tree-dump "gimple_simplified to _\[0-9\]* = \\(int\\) z1_\[0-9\]*\\(D\\);" "forwprop1" } } */ diff --git a/gcc/testsuite/gcc.dg/pr65779.c b/gcc/testsuite/gcc.dg/pr65779.c index 7d5c522d042..814cb2cdeef 100644 --- a/gcc/testsuite/gcc.dg/pr65779.c +++ b/gcc/testsuite/gcc.dg/pr65779.c @@ -1,6 +1,7 @@ /* PR debug/65779 */ /* { dg-do assemble } */ /* { dg-options "-O2 -fcompare-debug" } */ +/* { dg-xfail-if "" { powerpc-ibm-aix* } { "*" } { "" } } */ unsigned long foo (unsigned long x, unsigned char *y, unsigned int z) diff --git a/gcc/testsuite/gcc.dg/pr70405.c b/gcc/testsuite/gcc.dg/pr70405.c index bff390ff06d..a2bc96ac241 100644 --- a/gcc/testsuite/gcc.dg/pr70405.c +++ b/gcc/testsuite/gcc.dg/pr70405.c @@ -2,6 +2,7 @@ /* { dg-do compile } */ /* { dg-options "-O2 -fcompare-debug" } */ /* { dg-additional-options "-mavx512f" { target i?86-*-* x86_64-*-* } } */ +/* { dg-xfail-if "" { powerpc-ibm-aix* } { "*" } { "" } } */ typedef short V __attribute__ ((vector_size (32))); diff --git a/gcc/testsuite/gcc.dg/pr77834.c b/gcc/testsuite/gcc.dg/pr77834.c new file mode 100644 index 00000000000..a9085b95393 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr77834.c @@ -0,0 +1,18 @@ +/* PR target/77834 */ +/* { dg-do compile } */ +/* { dg-options "-O -ftree-pre -Wno-psabi" } */ +/* { dg-additional-options "-mstringop-strategy=libcall" { target i?86-*-* x86_64-*-* } } */ + +typedef int V __attribute__ ((vector_size (64))); + +V +foo (V u, V v, int w) +{ + do + { + if (u[0]) v ^= u[w]; + } + while ((V) { 0, u[w] }[1]); + u = (V) { v[v[0]], u[u[0]] }; + return v + u; +} diff --git a/gcc/testsuite/gcc.dg/pr77860.c b/gcc/testsuite/gcc.dg/pr77860.c new file mode 100644 index 00000000000..04346b16e77 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr77860.c @@ -0,0 +1,13 @@ +/* PR tree-optimization/77860 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-tree-vrp -fno-tree-forwprop -Wno-psabi" } */ + +typedef unsigned short V __attribute__((vector_size (16))); + +V +foo (V x, V y) +{ + V a = -x; + V b = -y; + return a * b; +} diff --git a/gcc/testsuite/gcc.dg/pr78148.c b/gcc/testsuite/gcc.dg/pr78148.c new file mode 100644 index 00000000000..c3c9b2e9a89 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr78148.c @@ -0,0 +1,31 @@ +/* PR target/78148 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fcompare-debug" } */ + +struct A { int a, b; }; +struct B { char c, d; }; +extern void bar (struct A, struct B); +struct C { char e, f; } a; +struct D +{ + int g; + struct C h[4]; +}; +struct D *e; + +struct D +foo (void) +{ + int b; + struct B c; + struct A d; + d.b = c.c = c.d = 0; + bar (d, c); +} + +void +baz () +{ + e->h[0].e = e->h[0].f = 0; + foo (); +} diff --git a/gcc/testsuite/gcc.dg/pr78185.c b/gcc/testsuite/gcc.dg/pr78185.c new file mode 100644 index 00000000000..405f7489dae --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr78185.c @@ -0,0 +1,28 @@ +/* { dg-do run { target *-*-linux* *-*-gnu* } } */ +/* { dg-options "-O" } */ + +#include <unistd.h> +#include <signal.h> +#include <stdlib.h> + +static char var1 = 0L; +static char *var2 = &var1; + +void do_exit (int i) +{ + exit (0); +} + +int main(void) +{ + struct sigaction s; + sigemptyset (&s.sa_mask); + s.sa_handler = do_exit; + s.sa_flags = 0; + sigaction (SIGALRM, &s, NULL); + alarm (1); + /* The following loop is infinite, the division by zero should not + be hoisted out of it. */ + for (; (var1 == 0 ? 0 : (100 / var1)) == *var2; ); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/store_merging_1.c b/gcc/testsuite/gcc.dg/store_merging_1.c index 35f4d82e6b2..4cc43dfd9e1 100644 --- a/gcc/testsuite/gcc.dg/store_merging_1.c +++ b/gcc/testsuite/gcc.dg/store_merging_1.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-require-effective-target non_strict_align } */ +/* { dg-require-effective-target store_merge } */ /* { dg-options "-O2 -fdump-tree-store-merging" } */ struct bar { diff --git a/gcc/testsuite/gcc.dg/store_merging_2.c b/gcc/testsuite/gcc.dg/store_merging_2.c index 8e2acf39089..8cd29f4243c 100644 --- a/gcc/testsuite/gcc.dg/store_merging_2.c +++ b/gcc/testsuite/gcc.dg/store_merging_2.c @@ -1,5 +1,5 @@ /* { dg-do run } */ -/* { dg-require-effective-target non_strict_align } */ +/* { dg-require-effective-target store_merge } */ /* { dg-options "-O2 -fdump-tree-store-merging" } */ struct bar diff --git a/gcc/testsuite/gcc.dg/store_merging_4.c b/gcc/testsuite/gcc.dg/store_merging_4.c index a3d67697d64..719c2c038e4 100644 --- a/gcc/testsuite/gcc.dg/store_merging_4.c +++ b/gcc/testsuite/gcc.dg/store_merging_4.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-require-effective-target non_strict_align } */ +/* { dg-require-effective-target store_merge } */ /* { dg-options "-O2 -fdump-tree-store-merging" } */ /* Check that we can merge interleaving stores that are guaranteed diff --git a/gcc/testsuite/gcc.dg/store_merging_5.c b/gcc/testsuite/gcc.dg/store_merging_5.c index 4ffe512b842..e6c349767bc 100644 --- a/gcc/testsuite/gcc.dg/store_merging_5.c +++ b/gcc/testsuite/gcc.dg/store_merging_5.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-require-effective-target non_strict_align } */ +/* { dg-require-effective-target store_merge } */ /* { dg-options "-O2 -fdump-tree-store-merging" } */ /* Make sure that non-aliasing non-constant interspersed stores do not diff --git a/gcc/testsuite/gcc.dg/store_merging_6.c b/gcc/testsuite/gcc.dg/store_merging_6.c index 42b5c4f92dc..314829da6d3 100644 --- a/gcc/testsuite/gcc.dg/store_merging_6.c +++ b/gcc/testsuite/gcc.dg/store_merging_6.c @@ -1,5 +1,5 @@ /* { dg-do run } */ -/* { dg-require-effective-target non_strict_align } */ +/* { dg-require-effective-target store_merge } */ /* { dg-options "-O2 -fdump-tree-store-merging" } */ /* Check that we can widen accesses to bitfields. */ diff --git a/gcc/testsuite/gcc.dg/store_merging_7.c b/gcc/testsuite/gcc.dg/store_merging_7.c index 4be352fef4a..c744ece6407 100644 --- a/gcc/testsuite/gcc.dg/store_merging_7.c +++ b/gcc/testsuite/gcc.dg/store_merging_7.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-require-effective-target non_strict_align } */ +/* { dg-require-effective-target store_merge } */ /* { dg-options "-O2 -fdump-tree-store-merging" } */ /* Check that we can merge consecutive array members through the pointer. diff --git a/gcc/testsuite/gcc.dg/store_merging_8.c b/gcc/testsuite/gcc.dg/store_merging_8.c new file mode 100644 index 00000000000..e710a544ff0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/store_merging_8.c @@ -0,0 +1,38 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target store_merge } */ +/* { dg-options "-O2 -fdump-tree-store-merging" } */ + +struct baz { + struct bar { + int a; + char b; + char c; + char d; + char e; + char f; + char g; + } a[4]; +} x; +struct baz *xx = &x; + +void +foo1 (int i) +{ + x.a[i].b = 0; + x.a[i].a = 0; + x.a[i].c = 0; + x.a[i].d = 0; + x.a[i].e = 0; +} + +void +foo2 (int i) +{ + x.a[i].b = 0; + x.a[i].a = 0; + x.a[i].c = 1; + x.a[i].d = 0; + x.a[i].e = 0; +} + +/* { dg-final { scan-tree-dump-times "Merging successful" 2 "store-merging" } } */ diff --git a/gcc/testsuite/gcc.dg/torture/fp-int-convert.h b/gcc/testsuite/gcc.dg/torture/fp-int-convert.h index 59773e34fa8..bbe96668d0b 100644 --- a/gcc/testsuite/gcc.dg/torture/fp-int-convert.h +++ b/gcc/testsuite/gcc.dg/torture/fp-int-convert.h @@ -53,6 +53,8 @@ do { \ TEST_I_F_VAL (U, F, HVAL1U (P, U), P_OK (P, U)); \ TEST_I_F_VAL (U, F, HVAL1U (P, U) + 1, P_OK (P, U)); \ TEST_I_F_VAL (U, F, HVAL1U (P, U) - 1, P_OK (P, U)); \ + TEST_I_F_VAL (I, F, WVAL0S (I), 1); \ + TEST_I_F_VAL (I, F, -WVAL0S (I), 1); \ } while (0) #define P_OK(P, T) ((P) >= sizeof(T) * CHAR_BIT) @@ -74,6 +76,7 @@ do { \ ? (S)1 \ : (((S)1 << (sizeof(S) * CHAR_BIT - 2)) \ + ((S)3 << (sizeof(S) * CHAR_BIT - 2 - P)))) +#define WVAL0S(S) (S)((S)1 << (sizeof(S) * CHAR_BIT / 2 - 1)) #define TEST_I_F_VAL(IT, FT, VAL, PREC_OK) \ do { \ diff --git a/gcc/testsuite/gcc.dg/torture/pr77309.c b/gcc/testsuite/gcc.dg/torture/pr77309.c new file mode 100644 index 00000000000..5bdbc0a0b83 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr77309.c @@ -0,0 +1,14 @@ +/* { dg-do run } */ + +int a, b; + +int main () +{ + long c = 1 % (2 ^ b); + c = -c & ~(~(b ^ ~b) || a); + + if (c >= 0) + __builtin_abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr78218.c b/gcc/testsuite/gcc.dg/torture/pr78218.c new file mode 100644 index 00000000000..b3e2892429d --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr78218.c @@ -0,0 +1,24 @@ +/* { dg-do run } */ + +struct +{ + int v; +} a[2]; + +int b; + +void __attribute__((noinline,noclone)) +check () +{ + if (a[0].v != 1) + __builtin_abort (); +} + +int main () +{ + a[1].v = 1; + a[0] = a[1]; + a[1].v = 0; + check (a); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/tree-prof/time-profiler-3.c b/gcc/testsuite/gcc.dg/tree-prof/time-profiler-3.c new file mode 100644 index 00000000000..69ce0260828 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-prof/time-profiler-3.c @@ -0,0 +1,22 @@ +/* { dg-options "-O2 -fdump-ipa-profile -fprofile-update=atomic" } */ +/* { dg-require-effective-target profile_update_atomic } */ + +__attribute__ ((noinline)) +int foo() +{ + return 0; +} + +__attribute__ ((noinline)) +int bar() +{ + return 1; +} + +int main () +{ + return foo (); +} +/* { dg-final-use-not-autofdo { scan-ipa-dump-times "Read tp_first_run: 0" 1 "profile"} } */ +/* { dg-final-use-not-autofdo { scan-ipa-dump-times "Read tp_first_run: 1" 1 "profile"} } */ +/* { dg-final-use-not-autofdo { scan-ipa-dump-times "Read tp_first_run: 2" 1 "profile"} } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/builtins-folding-gimple-ub.c b/gcc/testsuite/gcc.dg/tree-ssa/builtins-folding-gimple-ub.c index df0ede2ba5e..e1658d183c3 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/builtins-folding-gimple-ub.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/builtins-folding-gimple-ub.c @@ -17,6 +17,10 @@ main (void) if (__builtin_memchr (foo1, 'x', 1000)) /* Not folded away. */ __builtin_abort (); + /* STRNCMP. */ + if (strncmp ("a", "b", -1)) /* { dg-warning "implicit declaration of function" } */ + __builtin_abort (); + return 0; } diff --git a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-15.c b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-15.c new file mode 100644 index 00000000000..ac3018ef533 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-15.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ + +int +foo (int i) +{ + if (i > 0) + i = -i; + return i; +} + +/* { dg-final { scan-tree-dump-not "ABS" "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr20702.c b/gcc/testsuite/gcc.dg/tree-ssa/pr20702.c index cc7370cad4e..c896857748c 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr20702.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr20702.c @@ -4,7 +4,7 @@ immediate successors of the basic block. */ /* { dg-do compile } */ -/* { dg-options "-O2 -fno-tree-dominator-opts -fdump-tree-vrp1-details -fdelete-null-pointer-checks" } */ +/* { dg-options "-O2 -fno-tree-dominator-opts -fdisable-tree-evrp -fdump-tree-vrp1-details -fdelete-null-pointer-checks" } */ extern void bar (int); diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr21086.c b/gcc/testsuite/gcc.dg/tree-ssa/pr21086.c index e8b62c2ca1f..950371ba55d 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr21086.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr21086.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-vrp1 -fdump-tree-dce2 -fdelete-null-pointer-checks" } */ +/* { dg-options "-O2 -fdisable-tree-evrp -fdump-tree-vrp1 -fdump-tree-dce2 -fdelete-null-pointer-checks" } */ int foo (int *p) diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr54245.c b/gcc/testsuite/gcc.dg/tree-ssa/pr54245.c deleted file mode 100644 index b96e3e51f5b..00000000000 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr54245.c +++ /dev/null @@ -1,48 +0,0 @@ -/* { dg-do compile } */ -/* { dg-options "-O1 -fdump-tree-slsr-details" } */ - -#include <stdio.h> - -#define W1 22725 -#define W2 21407 -#define W3 19266 -#define W6 8867 - -void idct_row(short *row, int *dst) -{ - int a0, a1, b0, b1; - - a0 = W1 * row[0]; - a1 = a0; - - a0 += W2 * row[2]; - a1 += W6 * row[2]; - - b0 = W1 * row[1]; - b1 = W3 * row[1]; - - dst[0] = a0 + b0; - dst[1] = a0 - b0; - dst[2] = a1 + b1; - dst[3] = a1 - b1; -} - -static short block[8] = { 1, 2, 3, 4 }; - -int main(void) -{ - int out[4]; - int i; - - idct_row(block, out); - - for (i = 0; i < 4; i++) - printf("%d\n", out[i]); - - return !(out[2] == 87858 && out[3] == 10794); -} - -/* For now, disable inserting an initializer when the multiplication will - take place in a smaller type than originally. This test may be deleted - in future when this case is handled more precisely. */ -/* { dg-final { scan-tree-dump-times "Inserting initializer" 0 "slsr" { target { ! int16 } } } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr58480.c b/gcc/testsuite/gcc.dg/tree-ssa/pr58480.c index 7df8f8affbd..42898e72d4e 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr58480.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr58480.c @@ -1,5 +1,5 @@ /* { dg-do compile { target { ! keeps_null_pointer_checks } } } */ -/* { dg-options "-O2 -fdump-tree-vrp1 -fdelete-null-pointer-checks" } */ +/* { dg-options "-O2 -fdisable-tree-evrp -fdump-tree-vrp1 -fdelete-null-pointer-checks" } */ extern void eliminate (void); extern void* f1 (void *a, void *b) __attribute__((nonnull)); diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr71347.c b/gcc/testsuite/gcc.dg/tree-ssa/pr71347.c index 428e41bc3bc..d2f7f059f33 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr71347.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr71347.c @@ -14,4 +14,4 @@ void foo (void) } /* Load of X[i - i] can be omitted by reusing X[i] in previous iteration. */ -/* { dg-final { scan-tree-dump-not ".* = MEM.*;" "optimized" { xfail { ia64-*-* arm*-*-* m68k*-*-* } } } } */ +/* { dg-final { scan-tree-dump-not ".* = MEM.*;" "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/slsr-8.c b/gcc/testsuite/gcc.dg/tree-ssa/slsr-8.c index 2bd60aad546..585b660886b 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/slsr-8.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/slsr-8.c @@ -4,7 +4,7 @@ /* { dg-options "-O3 -fdump-tree-optimized" } */ int* -f (int s, int *c) +f (int s, int *c, int *d) { int a1, a2, a3, *x1, *x2, *x3; @@ -14,10 +14,16 @@ f (int s, int *c) x2 = c - a2; a3 = 6 * s; x3 = c - a3; - return x1 ? x2 : x3; + return x1 == d ? x2 : x3; } +/* Note that since some branch prediction heuristics changed, the + calculations of x2 and x3 are pushed downward into the legs + of the conditional, changing the code presented to SLSR. + However, this proves to be a useful test for introducing an + initializer with a cast, so we'll keep it as is. */ + /* There are 4 ' * ' instances in the decls (since "int * iftmp.0;" is - added), 1 parm, 2 in the code. The second one in the code can be - a widening mult. */ -/* { dg-final { scan-tree-dump-times " w?\\* " 7 "optimized" } } */ + added), 2 parms, 3 in the code. The second one in the code may + be a widening multiply (for example, on AArch64). */ +/* { dg-final { scan-tree-dump-times " w?\\* " 9 "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp08.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp08.c index 023b4eb3b94..c2da30b4b68 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/vrp08.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp08.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fno-tree-fre -fdump-tree-vrp1-details -fdelete-null-pointer-checks" } */ +/* { dg-options "-O2 -fno-tree-fre -fdisable-tree-evrp -fdump-tree-vrp1-details -fdelete-null-pointer-checks" } */ /* Compile with -fno-tree-fre -O2 to prevent CSEing *p. */ int diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp111.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp111.c new file mode 100644 index 00000000000..2511c1964bb --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp111.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-evrp" } */ + +void foo (void *p) __attribute__((nonnull(1))); + +void bar (void *p) +{ + foo (p); + if (!p) + __builtin_abort (); +} + +/* { dg-final { scan-tree-dump-not "abort" "evrp" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr78205.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr78205.c new file mode 100644 index 00000000000..e02502a3fc1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/bb-slp-pr78205.c @@ -0,0 +1,25 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target vect_double } */ +/* { dg-additional-options "-fdump-tree-optimized" } */ + +double x[2], a[4], b[4], c[5]; + +void foo () +{ + a[0] = c[0]; + a[1] = c[1]; + a[2] = c[0]; + a[3] = c[1]; + b[0] = c[2]; + b[1] = c[3]; + b[2] = c[2]; + b[3] = c[3]; + x[0] = c[4]; + x[1] = c[4]; +} + +/* We may not vectorize the store to x[] as it accesses c out-of bounds + but we do want to vectorize the other two store groups. */ + +/* { dg-final { scan-tree-dump-times "basic block vectorized" 1 "slp2" } } */ +/* { dg-final { scan-tree-dump-times "x\\\[\[0-1\]\\\] = " 2 "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/pr56541.c b/gcc/testsuite/gcc.dg/vect/pr56541.c index 16b8d7cb75b..d5def6899e4 100644 --- a/gcc/testsuite/gcc.dg/vect/pr56541.c +++ b/gcc/testsuite/gcc.dg/vect/pr56541.c @@ -24,4 +24,4 @@ void foo() } } -/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail { ! vect_cond_mixed } } } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-bswap32.c b/gcc/testsuite/gcc.dg/vect/vect-bswap32.c index 17132baf57b..7f3a915ee97 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-bswap32.c +++ b/gcc/testsuite/gcc.dg/vect/vect-bswap32.c @@ -1,4 +1,4 @@ -/* { dg-require-effective-target vect_bswap } */ +/* { dg-additional-options "-msse4" { target sse4_runtime } } */ #include "tree-vect.h" @@ -42,4 +42,4 @@ main (void) return 0; } -/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_bswap || sse4_runtime } } } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-bswap64.c b/gcc/testsuite/gcc.dg/vect/vect-bswap64.c index 745a7e73265..b9e421d1de4 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-bswap64.c +++ b/gcc/testsuite/gcc.dg/vect/vect-bswap64.c @@ -1,4 +1,4 @@ -/* { dg-require-effective-target vect_bswap } */ +/* { dg-additional-options "-msse4" { target sse4_runtime } } */ #include "tree-vect.h" @@ -42,4 +42,4 @@ main (void) return 0; } -/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_bswap || sse4_runtime } } } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-cond-2.c b/gcc/testsuite/gcc.dg/vect/vect-cond-2.c index 9a628567214..d7da8034f0c 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-cond-2.c +++ b/gcc/testsuite/gcc.dg/vect/vect-cond-2.c @@ -39,8 +39,6 @@ int main (void) return 0; } -/* The order of computation should not be changed for cond_expr, therefore, - it cannot be vectorized in reduction. */ -/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */ +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-nb-iter-ub-2.c b/gcc/testsuite/gcc.dg/vect/vect-nb-iter-ub-2.c index bc07b4bea0f..4e13702621f 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-nb-iter-ub-2.c +++ b/gcc/testsuite/gcc.dg/vect/vect-nb-iter-ub-2.c @@ -3,7 +3,7 @@ #include "tree-vect.h" int ii[32]; -char cc[66] = +char cc[66] __attribute__((aligned(1))) = { 0, 0, 1, 0, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 0, 8, 0, 9, 0, 10, 0, 11, 0, 12, 0, 13, 0, 14, 0, 15, 0, 16, 0, 17, 0, 18, 0, 19, 0, 20, 0, 21, 0, 22, 0, 23, 0, 24, 0, 25, 0, 26, 0, 27, 0, 28, 0, 29, 0, diff --git a/gcc/testsuite/gcc.dg/visibility-14.c b/gcc/testsuite/gcc.dg/visibility-14.c index 1c01f8399db..e1d85f0ed25 100644 --- a/gcc/testsuite/gcc.dg/visibility-14.c +++ b/gcc/testsuite/gcc.dg/visibility-14.c @@ -2,7 +2,7 @@ /* { dg-do compile } */ /* { dg-skip-if "" { *-*-darwin* } { "*" } { "" } } */ /* { dg-require-visibility "" } */ -/* { dg-final { scan-hidden "foo" } } */ +/* { dg-final { scan-hidden "foo" { xfail *-*-aix* } } } */ extern void foo(void) __attribute__ ((visibility ("hidden"))); int f () { diff --git a/gcc/testsuite/gcc.dg/visibility-15.c b/gcc/testsuite/gcc.dg/visibility-15.c index 8d331d76cae..4e69fa1db4c 100644 --- a/gcc/testsuite/gcc.dg/visibility-15.c +++ b/gcc/testsuite/gcc.dg/visibility-15.c @@ -2,7 +2,7 @@ /* { dg-do compile } */ /* { dg-skip-if "" { *-*-darwin* } { "*" } { "" } } */ /* { dg-require-visibility "" } */ -/* { dg-final { scan-hidden "foo" } } */ +/* { dg-final { scan-hidden "foo" { xfail *-*-aix* } } } */ extern void foo(void) __attribute__ ((visibility ("hidden"))); typedef void (*foo_t)(void); diff --git a/gcc/testsuite/gcc.dg/visibility-16.c b/gcc/testsuite/gcc.dg/visibility-16.c index 52a25cdef81..dcd5448d182 100644 --- a/gcc/testsuite/gcc.dg/visibility-16.c +++ b/gcc/testsuite/gcc.dg/visibility-16.c @@ -2,7 +2,7 @@ /* { dg-do compile } */ /* { dg-skip-if "" { *-*-darwin* } { "*" } { "" } } */ /* { dg-require-visibility "" } */ -/* { dg-final { scan-hidden "foo" } } */ +/* { dg-final { scan-hidden "foo" { xfail *-*-aix* } } } */ extern int foo __attribute__ ((visibility ("hidden"))); int f () { diff --git a/gcc/testsuite/gcc.dg/visibility-17.c b/gcc/testsuite/gcc.dg/visibility-17.c index 0ff3e83de4b..dc90d35839f 100644 --- a/gcc/testsuite/gcc.dg/visibility-17.c +++ b/gcc/testsuite/gcc.dg/visibility-17.c @@ -2,7 +2,7 @@ /* { dg-do compile } */ /* { dg-skip-if "" { *-*-darwin* } { "*" } { "" } } */ /* { dg-require-visibility "" } */ -/* { dg-final { scan-hidden "foo" } } */ +/* { dg-final { scan-hidden "foo" { xfail *-*-aix* } } } */ extern int foo __attribute__ ((visibility ("hidden"))); int *f () { diff --git a/gcc/testsuite/gcc.dg/visibility-18.c b/gcc/testsuite/gcc.dg/visibility-18.c index f54c73b198a..653e3b1971f 100644 --- a/gcc/testsuite/gcc.dg/visibility-18.c +++ b/gcc/testsuite/gcc.dg/visibility-18.c @@ -2,7 +2,7 @@ /* { dg-do compile } */ /* { dg-skip-if "" { *-*-darwin* } { "*" } { "" } } */ /* { dg-require-visibility "" } */ -/* { dg-final { scan-hidden "foo" } } */ +/* { dg-final { scan-hidden "foo" { xfail *-*-aix* } } } */ extern int foo __attribute__ ((visibility ("hidden"))); int *test = &foo; diff --git a/gcc/testsuite/gcc.dg/visibility-19.c b/gcc/testsuite/gcc.dg/visibility-19.c index 3c2455fb291..2b0b9beb401 100644 --- a/gcc/testsuite/gcc.dg/visibility-19.c +++ b/gcc/testsuite/gcc.dg/visibility-19.c @@ -2,7 +2,7 @@ /* { dg-do compile } */ /* { dg-skip-if "" { *-*-darwin* } { "*" } { "" } } */ /* { dg-require-visibility "" } */ -/* { dg-final { scan-hidden "foo" } } */ +/* { dg-final { scan-hidden "foo" { xfail *-*-aix* } } } */ extern void foo(void) __attribute__ ((visibility ("hidden"))); typedef void (*foo_t)(void); |