diff options
Diffstat (limited to 'gcc/testsuite')
40 files changed, 692 insertions, 81 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ca5cf9f7cc9..2733cb52dfd 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,112 @@ +2009-05-14 Ian Lance Taylor <iant@google.com> + + * gcc.dg/Wcxx-compat-9.c: New testcase. + +2009-05-14 Janus Weil <janus@gcc.gnu.org> + + PR fortran/39996 + * gfortran.dg/func_decl_2.f90: Modified (replacing warnings by errors). + * gfortran.dg/duplicate_type_2.f90: Ditto. + * gfortran.dg/duplicate_type_3.f90: New. + +2009-05-14 Laurent GUERBY <laurent@guerby.net> + + * ada/acats/tests/c3/c38202a.ada: Use Impdef. + * ada/acats/tests/c5/c59002c.ada: Likewise. + +2009-05-13 Taras Glek <tglek@mozilla.com> + + * g++.dg/plugin/attribute_plugin-test-1.C Testcase input for custom attributes and decl smashing + * g++.dg/plugin/attribute_plugin.c Testcase plugin to test user attributes + * g++.dg/plugin/dumb_plugin.c Fixed typo + * g++.dg/plugin/plugin.exp Added attribute_plugin test + +2009-05-14 Jakub Jelinek <jakub@redhat.com> + + PR fortran/39865 + * gfortran.dg/pr39865.f90: New test. + * gfortran.dg/hollerith.f90: Don't expect errors for CHARACTER + arrays in FMT=. + * gfortran.dg/hollerith_f95.f90: Likewise. + * gfortran.dg/hollerith6.f90: New test. + * gfortran.dg/hollerith7.f90: New test. + +2009-05-14 Manuel Lopez-Ibanez <manu@gcc.gnu.org> + + PR cpp/36674 + * gcc.dg/cpp/pr36674.i: New. + +2009-05-14 Ben Elliston <bje@au.ibm.com> + + PR middle-end/40035 + * gcc.c-torture/compile/pr40035.c: New test. + +2009-05-13 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * gcc.target/i386/pr39543-2.c: Skip if ilp32 && pic. + +2009-05-12 Tobias Burnus <burnus@net-b.de> + + PR fortran/40110 + * gfortran.dg/bind_c_usage_18.f90: Change dg-error into dg-warning. + * gfortran.dg/c_kind_tests_2.f03: Ditto. + * gfortran.dg/interop_params.f03: Ditto. + +2009-05-12 Jan Hubicka <jh@suse.cz> + + * gcc.dg/tree-ssa/loop-36.c: Reduce amount of iterations to 2 so unrolling + still happens. + * gcc.dg/ipa/ipacost-1.c: Prevent inlining + * gcc.dg/ipa/ipacost-2.c: Likewise. + * gcc.dg/vect/slp-3.c: Loop is no longer unrolled. + +2009-05-12 David Billinghurst <billingd@gcc.gnu.org> + + * gfortran.dg/default_format_1.f90: XFAIL on cygwin. + +2009-05-12 David Billinghurst <billingd@gcc.gnu.org> + + * lib/target-supports.exp (check_profiling_available): Return + false for -p on *-*-cygwin* targets. + +2009-05-11 H.J. Lu <hongjiu.lu@intel.com> + + PR tree-optimization/38632 + * g++.dg/tree-ssa/pr38632.C: New. + +2009-05-11 Jan Hubicka <jh@suse.cz> + + * gcc.dg/tree-ssa/pr21829.c: Simplify matching since + we now optimize better. + * gcc.dg/Wunreachable-8.c: Bogus warnings now come + out at different places. + * gcc.dg/vect/vect-92.c: Increase loop iteration count to prevent + unroling. + * gcc.dg/vect/vect-76.c: Likewise. + * gcc.dg/vect/vect-70.c: Likewise. + * gcc.dg/vect/vect-66.c: Likewise. + * gcc.dg/vect/no-section-anchors-vect-66.c: Likewise. + * gcc.dg/vect/slp-3.c: One of loops gets now fully unrolled. + +2009-05-11 H.J. Lu <hongjiu.lu@intel.com> + + PR middle-end/40080 + * gcc.c-torture/compile/pr40080.c: New. + +2009-05-11 Paolo Bonzini <bonzini@gnu.org> + + * gcc.c-torture/compile/pr40026.c: New testcase. + +2009-05-11 Janus Weil <janus@gcc.gnu.org> + + PR fortran/40089 + * gfortran.dg/proc_ptr_comp_7.f90: New. + +2009-05-11 Ira Rosen <irar@il.ibm.com> + + PR tree-optimization/40074 + * gcc.dg/vect/pr40074.c: New test. + 2009-05-10 Ian Lance Taylor <iant@google.com> * gcc.dg/Wcxx-compat-7.c: New testcase. diff --git a/gcc/testsuite/ada/acats/tests/c3/c38202a.ada b/gcc/testsuite/ada/acats/tests/c3/c38202a.ada index e0b3b856476..d0350fc1fc9 100644 --- a/gcc/testsuite/ada/acats/tests/c3/c38202a.ada +++ b/gcc/testsuite/ada/acats/tests/c3/c38202a.ada @@ -30,6 +30,7 @@ -- AH 9/12/86 -- EDS 7/14/98 AVOID OPTIMIZATION +with Impdef; WITH REPORT; USE REPORT; PROCEDURE C38202A IS BEGIN @@ -84,7 +85,7 @@ BEGIN P.GO_ON; ACCEPT TSK_DONE; WHILE (NOT P'TERMINATED AND COUNTER <= 3) LOOP - DELAY 10.0; + DELAY 10.0 * Impdef.One_Second; COUNTER := COUNTER + 1; END LOOP; @@ -166,7 +167,7 @@ BEGIN F1.ALL.GO_ON; ACCEPT TSK_DONE; WHILE (NOT F1'TERMINATED AND COUNTER <= 3) LOOP - DELAY 10.0; + DELAY 10.0 * Impdef.One_Second; COUNTER := COUNTER + 1; END LOOP; diff --git a/gcc/testsuite/ada/acats/tests/c5/c59002c.ada b/gcc/testsuite/ada/acats/tests/c5/c59002c.ada index a81c1c1e9ce..cc01a7e6c3a 100644 --- a/gcc/testsuite/ada/acats/tests/c5/c59002c.ada +++ b/gcc/testsuite/ada/acats/tests/c5/c59002c.ada @@ -33,6 +33,7 @@ -- SPS 12/13/82 -- PWN 11/30/94 REMOVED PRAGMA PRIORITY INSTANCES FOR ADA 9X. +with Impdef; WITH REPORT; WITH SYSTEM; USE SYSTEM; @@ -64,7 +65,7 @@ BEGIN BEGIN WHILE E2'COUNT <= 0 LOOP - DELAY 1.0 ; + DELAY 1.0 * Impdef.One_Second; END LOOP; SELECT @@ -76,7 +77,7 @@ BEGIN GOTO L123 ; FAILED( "'GOTO' NOT OBEYED (1)" ); OR - DELAY 10.0 ; + DELAY 10.0 * Impdef.One_Second; FAILED( "DELAY ALTERNATIVE SELECTED (1)" ); END SELECT; @@ -116,7 +117,7 @@ BEGIN FAILED( " E2 ACCEPTED; NO ENTRY CALL (2)" ); END ; OR - DELAY 10.0 ; + DELAY 10.0 * Impdef.One_Second; GOTO L321 ; FAILED( "'GOTO' NOT OBEYED (2)" ); END SELECT; diff --git a/gcc/testsuite/g++.dg/plugin/attribute_plugin-test-1.C b/gcc/testsuite/g++.dg/plugin/attribute_plugin-test-1.C new file mode 100644 index 00000000000..abb1328670a --- /dev/null +++ b/gcc/testsuite/g++.dg/plugin/attribute_plugin-test-1.C @@ -0,0 +1,16 @@ +// { dg-warning "Callback to register attributes" } + +void normal_func (char c, char c2); +void normal_func (char __attribute__((user("param"))) c, char); +void normal_func (char c, char __attribute__((user("param"))) c2) +{ +} // { dg-warning "attribute 'user' on param 'c' of function normal_func" } +// { dg-warning "attribute 'user' on param 'c2' of function normal_func" "" { target *-*-* } 7 } + +class Foo { + void method (char __attribute__((user("param"))) c); +}; + +void Foo::method(char c) +{ +} // { dg-warning "attribute 'user' on param 'c' of function method" } diff --git a/gcc/testsuite/g++.dg/plugin/attribute_plugin.c b/gcc/testsuite/g++.dg/plugin/attribute_plugin.c new file mode 100644 index 00000000000..d071762102b --- /dev/null +++ b/gcc/testsuite/g++.dg/plugin/attribute_plugin.c @@ -0,0 +1,66 @@ +/* Demonstrates how to add custom attributes */ + +#include <stdlib.h> +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "tree.h" +#include "tree-pass.h" +#include "intl.h" +#include "gcc-plugin.h" + +/* Attribute handler callback */ + +static tree +handle_user_attribute (tree *node, tree name, tree args, + int flags, bool *no_add_attrs) +{ + return NULL_TREE; +} + +/* Attribute definition */ + +static struct attribute_spec user_attr = + { "user", 1, 1, false, false, false, handle_user_attribute }; + +/* Plugin callback called during attribute registration */ + +static void +register_attributes (void *event_data, void *data) +{ + warning (0, G_("Callback to register attributes")); + register_attribute (&user_attr); +} + +/* Callback function to invoke before the function body is genericized. */ + +void +handle_pre_generic (void *event_data, void *data) +{ + tree fndecl = (tree) event_data; + tree arg; + for (arg = DECL_ARGUMENTS(fndecl); arg; arg = TREE_CHAIN (arg)) { + tree attr; + for (attr = DECL_ATTRIBUTES (arg); attr; attr = TREE_CHAIN (attr)) { + tree attrname = TREE_PURPOSE (attr); + tree attrargs = TREE_VALUE (attr); + warning (0, G_("attribute '%s' on param '%s' of function %s"), + IDENTIFIER_POINTER (attrname), + IDENTIFIER_POINTER (DECL_NAME (arg)), + IDENTIFIER_POINTER (DECL_NAME (fndecl)) + ); + } + } +} + +int +plugin_init (const char *plugin_name, + struct plugin_gcc_version *version, + int argc, struct plugin_argument *argv) +{ + register_callback (plugin_name, PLUGIN_CXX_CP_PRE_GENERICIZE, + handle_pre_generic, NULL); + + register_callback (plugin_name, PLUGIN_ATTRIBUTES, register_attributes, NULL); + return 0; +} diff --git a/gcc/testsuite/g++.dg/plugin/dumb_plugin.c b/gcc/testsuite/g++.dg/plugin/dumb_plugin.c index 0c62f89e109..839dc2b1c8a 100644 --- a/gcc/testsuite/g++.dg/plugin/dumb_plugin.c +++ b/gcc/testsuite/g++.dg/plugin/dumb_plugin.c @@ -21,7 +21,7 @@ handle_struct (void *event_data, void *data) IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (type)))); } -/* Callback function to invoke before the program is genericized. */ +/* Callback function to invoke before the function body is genericized. */ void handle_pre_generic (void *event_data, void *data) diff --git a/gcc/testsuite/g++.dg/plugin/plugin.exp b/gcc/testsuite/g++.dg/plugin/plugin.exp index e1f6d89ae28..eb019986ffe 100644 --- a/gcc/testsuite/g++.dg/plugin/plugin.exp +++ b/gcc/testsuite/g++.dg/plugin/plugin.exp @@ -47,6 +47,7 @@ load_lib plugin-support.exp # Specify the plugin source file and the associated test files in a list. # plugin_test_list={ {plugin1 test1 test2 ...} {plugin2 test1 ...} ... } set plugin_test_list [list \ + { attribute_plugin.c attribute_plugin-test-1.C } \ { selfassign.c self-assign-test-1.C self-assign-test-2.C self-assign-test-3.C } \ { dumb_plugin.c dumb-plugin-test-1.C } ] diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr38632.C b/gcc/testsuite/g++.dg/tree-ssa/pr38632.C new file mode 100644 index 00000000000..04fca228021 --- /dev/null +++ b/gcc/testsuite/g++.dg/tree-ssa/pr38632.C @@ -0,0 +1,22 @@ +// { dg-do compile } +// { dg-require-effective-target pthread } +// { dg-options "-O -ftree-parallelize-loops=2" } + +void foo(); + +void bar(int n, char *p) +{ + try + { + foo(); + ++n; + foo(); + for (int i = 0; i < n-1; ++i) + p[i] = 0; + } + catch (...) + { + for (int i = 0; i < n; ++i) + p[i] = 0; + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr40026.c b/gcc/testsuite/gcc.c-torture/compile/pr40026.c new file mode 100644 index 00000000000..0d08f0dc8ac --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr40026.c @@ -0,0 +1,15 @@ +typedef struct { + unsigned long bits; +} S; +struct T { + S span; + int flags; +}; + +struct T f(int x) +{ + return (struct T) { + .span = (S) { 0UL }, + .flags = (x ? 256 : 0), + }; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr40035.c b/gcc/testsuite/gcc.c-torture/compile/pr40035.c new file mode 100644 index 00000000000..1bf1a7c4c41 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr40035.c @@ -0,0 +1,20 @@ +typedef __SIZE_TYPE__ size_t; +void *memmove (void *dest, const void *src, size_t count); +size_t strlen (const char *s); + +int +foo (char *param, char *val) +{ + if (val) + { + if (val == param + strlen (param) + 1) + val[-1] = '='; + else if (val == param + strlen (param) + 2) + { + val[-2] = '='; + memmove (val - 1, val, strlen (val) + 1); + val--; + } + } + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr40080.c b/gcc/testsuite/gcc.c-torture/compile/pr40080.c new file mode 100644 index 00000000000..e36f14273e8 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr40080.c @@ -0,0 +1,44 @@ +extern void *ff(void*,int); + +struct lpgl { struct lpgl *next; }; +struct lpgd { struct lpgl *first; }; + +typedef int (*xfn)( ); +static void xDP_IF_EnumGroupsInGroup ( void *a, int b, xfn fn) +{ + struct lpgd *lpGData; + struct lpgl *lpGList; + + if( ( lpGData = ff( a, b ) ) == ((void *)0) ) + return; + + if( lpGData->first == ((void *)0) ) + return; + lpGList = lpGData->first; + + for( ;; ) { + if( !(*fn)( ) ) + return; + if( lpGList->next == ((void *)0) ) + break; + lpGList = lpGList->next; + } + return; +} + + +static int +xcbDeletePlayerFromAllGroups() { + xDP_IF_EnumGroupsInGroup(0, 0, 0); + return 1; +} + +void xDP_IF_EnumGroups( xfn fn) { + xDP_IF_EnumGroupsInGroup( 0, 0, fn); +} + +static void xDP_IF_DestroyPlayer () { + xDP_IF_EnumGroups( xcbDeletePlayerFromAllGroups); +} + +void* foo=xDP_IF_DestroyPlayer; diff --git a/gcc/testsuite/gcc.dg/Wcxx-compat-9.c b/gcc/testsuite/gcc.dg/Wcxx-compat-9.c new file mode 100644 index 00000000000..8a3867c11c9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/Wcxx-compat-9.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-options "-Wc++-compat" } */ + +enum e { FIRST, LAST }; + +extern void f2 (enum e); + +void +f1 () +{ + enum e v; + + for (v = FIRST; v < LAST; ++v) /* { dg-warning "invalid in C\[+\]\[+\]" } */ + f2 (v); + for (v = FIRST; v < LAST; v++) /* { dg-warning "invalid in C\[+\]\[+\]" } */ + f2 (v); + for (v = LAST; v > FIRST; --v) /* { dg-warning "invalid in C\[+\]\[+\]" } */ + f2 (v); + for (v = LAST; v > FIRST; v--) /* { dg-warning "invalid in C\[+\]\[+\]" } */ + f2 (v); +} diff --git a/gcc/testsuite/gcc.dg/Wunreachable-2.c b/gcc/testsuite/gcc.dg/Wunreachable-2.c index 8242441b0be..55a8f9cca01 100644 --- a/gcc/testsuite/gcc.dg/Wunreachable-2.c +++ b/gcc/testsuite/gcc.dg/Wunreachable-2.c @@ -9,8 +9,8 @@ void bar (void) { int i; - for (i = 0; i < 2; i++) - if (! foo (a[i])) + for (i = 0; i < 2; i++) /* { dg-bogus "will never be executed" "" { xfail *-*-* } } */ + if (! foo (a[i])) /* { dg-bogus "will never be executed" "" { xfail *-*-* } } */ return; baz (); /* { dg-bogus "will never be executed" } */ diff --git a/gcc/testsuite/gcc.dg/Wunreachable-8.c b/gcc/testsuite/gcc.dg/Wunreachable-8.c index 81254ba3b2a..1a13d64243e 100644 --- a/gcc/testsuite/gcc.dg/Wunreachable-8.c +++ b/gcc/testsuite/gcc.dg/Wunreachable-8.c @@ -4,7 +4,7 @@ float Factorial(float X) { float val = 1.0; int k,j; - for (k=1; k < 5; k++) + for (k=1; k < 5; k++) /* { dg-bogus "will never be executed" "" { xfail *-*-* } } */ { val += 1.0; /* { dg-bogus "will never be executed" "" { xfail *-*-* } } */ } diff --git a/gcc/testsuite/gcc.dg/cpp/pr36674.i b/gcc/testsuite/gcc.dg/cpp/pr36674.i new file mode 100644 index 00000000000..9362d5a4080 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/pr36674.i @@ -0,0 +1,12 @@ +/* PR cpp/36674 #include location is offset by one row in errors from preprocessed files */ +/* { dg-do compile } */ +/* { dg-options "-fshow-column" } */ +# 1 "gcc/testsuite/gcc.dg/pr36674.c" +# 1 "<built-in>" +# 1 "<command-line>" +# 1 "gcc/testsuite/gcc.dg/pr36674.c" +# 1 "gcc/testsuite/gcc.dg/pr36674.h" 1 +not_declared_yet(); +# 1 "gcc/testsuite/gcc.dg/pr36674.c" 2 +/* { dg-message "file included from \[^\n\]*pr36674.c:1:" "correct include line" { target *-*-* } 0 } */ +/* { dg-message "pr36674.h:1:1: warning: data definition has no type or storage class" "correct warning" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/gcc.dg/ipa/ipacost-1.c b/gcc/testsuite/gcc.dg/ipa/ipacost-1.c index 1c75c6cfde5..d91546899ea 100644 --- a/gcc/testsuite/gcc.dg/ipa/ipacost-1.c +++ b/gcc/testsuite/gcc.dg/ipa/ipacost-1.c @@ -46,6 +46,8 @@ i_can_not_be_propagated_fully2 (int *a) main() { i_can_be_propagated_fully2 (array); + i_can_be_propagated_fully2 (array); + i_can_not_be_propagated_fully2 (array); i_can_not_be_propagated_fully2 (array); } diff --git a/gcc/testsuite/gcc.dg/ipa/ipacost-2.c b/gcc/testsuite/gcc.dg/ipa/ipacost-2.c index 46db85fde3e..958059c73e6 100644 --- a/gcc/testsuite/gcc.dg/ipa/ipacost-2.c +++ b/gcc/testsuite/gcc.dg/ipa/ipacost-2.c @@ -47,6 +47,8 @@ i_can_not_be_propagated_fully2 (int *a) main() { i_can_be_propagated_fully2 (array); + i_can_be_propagated_fully2 (array); + i_can_not_be_propagated_fully2 (array); i_can_not_be_propagated_fully2 (array); } @@ -54,7 +56,7 @@ main() /* { dg-final { scan-ipa-dump-times "versioned function i_can_be_propagated_fully " 1 "cp" } } */ /* { dg-final { scan-ipa-dump-times "versioned function i_can_not_be_propagated_fully2" 1 "cp" } } */ /* { dg-final { scan-ipa-dump-times "versioned function i_can_not_be_propagated_fully " 1 "cp" } } */ -/* { dg-final { scan-tree-dump-not "i_can_be_propagated" "optimized" } } */ -/* { dg-final { scan-tree-dump-not "i_can_be_propagated" "optimized" } } */ +/* { dg-final { scan-tree-dump-not "i_can_be_propagated_fully \\(" "optimized" } } */ +/* { dg-final { scan-tree-dump-not "i_can_be_propagated_fully2 \\(" "optimized" } } */ /* { dg-final { cleanup-ipa-dump "cp" } } */ /* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/loop-36.c b/gcc/testsuite/gcc.dg/tree-ssa/loop-36.c index 0af4d534a7f..9e917376581 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/loop-36.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/loop-36.c @@ -1,7 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-O2 -fdump-tree-dce2" } */ -struct X { float array[4]; }; +struct X { float array[2]; }; struct X a,b; @@ -9,9 +9,9 @@ float foobar () { float s = 0; unsigned int d; struct X c; - for (d=0; d<4; ++d) + for (d=0; d<2; ++d) c.array[d] = a.array[d] * b.array[d]; - for (d=0; d<4; ++d) + for (d=0; d<2; ++d) s+=c.array[d]; return s; } diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr21829.c b/gcc/testsuite/gcc.dg/tree-ssa/pr21829.c index 6b5c4bbf1ce..c95714ab9fb 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr21829.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr21829.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-optimized -fdump-tree-cddce2" } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ int test(int v) { @@ -16,33 +16,7 @@ int test(int v) return x; } -/* This should be optimized to +/* This should be unrolled and optimized into conditional set of return value "v < 0". */ - if (v <= 0) goto <L1>; else goto <L3>; - - <L1>:; - - # x_1 = PHI <0(3), 1(1)>; - <L3>:; - return x_1; - - retaining only a single conditional. This doesn't work as nobody - combines the two tests - - if (v < 0) goto <bb 4>; else goto <bb 3>; - - <bb 3>: - - if (v <= 0) goto <bb 4>; else goto <bb 5>; - - this late in the game. tree-ssa-ifcombine.c would do it if we would - unroll the loop during early loop unrolling though. - - For now vrp2 does all the needed folding and threading and cddce2 - provides a nice IL to scan. */ - -/* { dg-final { scan-tree-dump-times "if " 1 "optimized" { xfail *-*-* } } } */ -/* { dg-final { scan-tree-dump-times "if " 2 "cddce2" } } */ -/* { dg-final { scan-tree-dump "x_. = PHI <0\\\(.\\\), 1\\\(.\\\)>" "cddce2" } } */ -/* { dg-final { cleanup-tree-dump "cddce2" } } */ +/* { dg-final { scan-tree-dump-not "if \\(" "optimized" } } */ /* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-66.c b/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-66.c index d590975e57f..49a9098f79f 100644 --- a/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-66.c +++ b/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-66.c @@ -3,7 +3,7 @@ #include <stdarg.h> #include "tree-vect.h" -#define N 8 +#define N 16 int ia[8][5][N+2]; int ic[16][16][5][N+2]; diff --git a/gcc/testsuite/gcc.dg/vect/pr40074.c b/gcc/testsuite/gcc.dg/vect/pr40074.c new file mode 100644 index 00000000000..6459f1b552e --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr40074.c @@ -0,0 +1,54 @@ +/* { dg-require-effective-target vect_int } */ + +#include <stdarg.h> +#include "tree-vect.h" + +#define N 16 + +typedef struct { + int a; + int b; + int c; + int d; +} s; + + +s arr[N] = {{7,0,1,5}, {7,2,3,5}, {7,4,5,5}, {7,6,7,5}, {7,8,9,5}, {7,10,11,5}, {7,12,13,5}, {7,14,15,5}, {7,16,17,5}, {7,18,19,5}, {7,20,21,5}, {7,22,23,5}, {7,24,25,5}, {7,26,27,5}, {7,28,29,5}, {7,30,31,5}}; + +__attribute__ ((noinline)) int +main1 () +{ + s *p = arr, *q = arr + 1; + int res[N]; + int i; + + for (i = 0; i < N-1; i++) + { + res[i] = p->b + p->d + q->b; + p++; + q++; + } + + /* check results: */ + for (i = 0; i < N-1; i++) + { + if (res[i] != arr[i].b + arr[i].d + arr[i+1].b) + abort (); + } + + return 0; +} + +int main (void) +{ + int i; + + check_vect (); + + main1 (); + + return 0; +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/vect-66.c b/gcc/testsuite/gcc.dg/vect/vect-66.c index a332fa024b9..e0b23cd6550 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-66.c +++ b/gcc/testsuite/gcc.dg/vect/vect-66.c @@ -3,7 +3,7 @@ #include <stdarg.h> #include "tree-vect.h" -#define N 8 +#define N 16 __attribute__ ((noinline)) void main1 () diff --git a/gcc/testsuite/gcc.dg/vect/vect-70.c b/gcc/testsuite/gcc.dg/vect/vect-70.c index df7de31f34e..23b1902e54f 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-70.c +++ b/gcc/testsuite/gcc.dg/vect/vect-70.c @@ -3,7 +3,7 @@ #include <stdarg.h> #include "tree-vect.h" -#define N 12 +#define N 24 struct s{ int m; diff --git a/gcc/testsuite/gcc.dg/vect/vect-76.c b/gcc/testsuite/gcc.dg/vect/vect-76.c index 847b5e5259d..7097e7a821e 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-76.c +++ b/gcc/testsuite/gcc.dg/vect/vect-76.c @@ -3,7 +3,7 @@ #include <stdarg.h> #include "tree-vect.h" -#define N 12 +#define N 24 #define OFF 4 /* Check handling of accesses for which the "initial condition" - diff --git a/gcc/testsuite/gcc.dg/vect/vect-92.c b/gcc/testsuite/gcc.dg/vect/vect-92.c index 01c751fbfa3..3a64e251cb2 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-92.c +++ b/gcc/testsuite/gcc.dg/vect/vect-92.c @@ -22,13 +22,13 @@ main1 () { int i; - for (i = 0; i < 5; i++) + for (i = 0; i < 10; i++) { pa[i+1] = pb[i+1] * pc[i+1]; } /* check results: */ - for (i = 0; i < 5; i++) + for (i = 0; i < 10; i++) { if (pa[i+1] != (pb[i+1] * pc[i+1])) abort (); @@ -42,13 +42,13 @@ main2 () { int i; - for (i = 0; i < 6; i++) + for (i = 0; i < 12; i++) { pa[i+1] = pb[i+1] * pc[i+1]; } /* check results: */ - for (i = 0; i < 6; i++) + for (i = 0; i < 12; i++) { if (pa[i+1] != (pb[i+1] * pc[i+1])) abort (); diff --git a/gcc/testsuite/gcc.target/i386/pr39543-2.c b/gcc/testsuite/gcc.target/i386/pr39543-2.c index c292041a700..04e980efa7a 100644 --- a/gcc/testsuite/gcc.target/i386/pr39543-2.c +++ b/gcc/testsuite/gcc.target/i386/pr39543-2.c @@ -1,6 +1,7 @@ /* PR inline-asm/39543 */ /* { dg-do compile } */ /* { dg-options "-O3" } */ +/* { dg-skip-if "" { ilp32 && { ! nonpic } } { "*" } { "" } } */ float __attribute__ ((aligned (16))) s0[128]; const float s1 = 0.707; diff --git a/gcc/testsuite/gfortran.dg/bind_c_usage_18.f90 b/gcc/testsuite/gfortran.dg/bind_c_usage_18.f90 index 30534cca9a9..2bce215af19 100644 --- a/gcc/testsuite/gfortran.dg/bind_c_usage_18.f90 +++ b/gcc/testsuite/gfortran.dg/bind_c_usage_18.f90 @@ -7,7 +7,7 @@ subroutine foo(x,y,z,a) bind(c) ! { dg-warning "but may not be C interoperable" use iso_c_binding implicit none integer(4) :: x - integer(c_float) :: y ! { dg-error "C kind type parameter is for type REAL" } + integer(c_float) :: y ! { dg-warning "C kind type parameter is for type REAL" } complex(c_float) :: z ! OK, c_float == c_float_complex real(c_float_complex) :: a ! OK, c_float == c_float_complex end subroutine foo @@ -16,8 +16,8 @@ use iso_c_binding implicit none integer, parameter :: it = c_int integer, parameter :: dt = c_double -complex(c_int), target :: z1 ! { dg-error "C kind type parameter is for type INTEGER" } -complex(it), target :: z2 ! { dg-error "C kind type parameter is for type INTEGER" } +complex(c_int), target :: z1 ! { dg-warning "C kind type parameter is for type INTEGER" } +complex(it), target :: z2 ! { dg-warning "C kind type parameter is for type INTEGER" } complex(c_double), target :: z3 ! OK complex(dt), target :: z4 ! OK type(c_ptr) :: ptr diff --git a/gcc/testsuite/gfortran.dg/c_kind_tests_2.f03 b/gcc/testsuite/gfortran.dg/c_kind_tests_2.f03 index ced31a554ba..aaaee978adc 100644 --- a/gcc/testsuite/gfortran.dg/c_kind_tests_2.f03 +++ b/gcc/testsuite/gfortran.dg/c_kind_tests_2.f03 @@ -4,11 +4,11 @@ module c_kind_tests_2 integer, parameter :: myF = c_float real(myF), bind(c) :: myCFloat - integer(myF), bind(c) :: myCInt ! { dg-error "is for type REAL" } - integer(c_double), bind(c) :: myCInt2 ! { dg-error "is for type REAL" } + integer(myF), bind(c) :: myCInt ! { dg-warning "is for type REAL" } + integer(c_double), bind(c) :: myCInt2 ! { dg-warning "is for type REAL" } integer, parameter :: myI = c_int - real(myI) :: myReal ! { dg-error "is for type INTEGER" } - real(myI), bind(c) :: myCFloat2 ! { dg-error "is for type INTEGER" } + real(myI) :: myReal ! { dg-warning "is for type INTEGER" } + real(myI), bind(c) :: myCFloat2 ! { dg-warning "is for type INTEGER" } real(4), bind(c) :: myFloat ! { dg-warning "may not be a C interoperable" } end module c_kind_tests_2 diff --git a/gcc/testsuite/gfortran.dg/default_format_1.f90 b/gcc/testsuite/gfortran.dg/default_format_1.f90 index 1c6e71ebc71..75f08af0f8d 100644 --- a/gcc/testsuite/gfortran.dg/default_format_1.f90 +++ b/gcc/testsuite/gfortran.dg/default_format_1.f90 @@ -1,6 +1,7 @@ -! { dg-do run { xfail spu-*-* } } +! { dg-do run { xfail spu-*-* *-*-cygwin* } } ! Test XFAILed on Darwin because the system's printf() lacks -! proper support for denormals. +! proper support for denormals. XFAILed on cygwin as the result +! is off by one bit in some cases. ! ! This tests that the default formats for formatted I/O of reals are ! wide enough and have enough precision, by checking that values can diff --git a/gcc/testsuite/gfortran.dg/duplicate_type_2.f90 b/gcc/testsuite/gfortran.dg/duplicate_type_2.f90 index 5b86dc6e775..0fd9258fe80 100644 --- a/gcc/testsuite/gfortran.dg/duplicate_type_2.f90 +++ b/gcc/testsuite/gfortran.dg/duplicate_type_2.f90 @@ -7,14 +7,14 @@ INTEGER FUNCTION foo () IMPLICIT NONE - INTEGER :: foo ! { dg-warning "basic type of" } - INTEGER :: foo ! { dg-warning "basic type of" } + INTEGER :: foo ! { dg-error "basic type of" } + INTEGER :: foo ! { dg-error "basic type of" } foo = 42 END FUNCTION foo INTEGER FUNCTION bar () RESULT (x) IMPLICIT NONE - INTEGER :: x ! { dg-warning "basic type of" } + INTEGER :: x ! { dg-error "basic type of" } INTEGER :: y INTEGER :: y ! { dg-error "basic type of" } diff --git a/gcc/testsuite/gfortran.dg/duplicate_type_3.f90 b/gcc/testsuite/gfortran.dg/duplicate_type_3.f90 new file mode 100644 index 00000000000..802029db0ca --- /dev/null +++ b/gcc/testsuite/gfortran.dg/duplicate_type_3.f90 @@ -0,0 +1,48 @@ +! { dg-do compile } +! +! PR 39996: Double typing of function results not detected +! +! Contributed by Janus Weil <janus@gcc.gnu.org> + + interface + real function A () + end function + end interface + real :: A ! { dg-error "already has basic type of" } + + real :: B + interface + real function B () ! { dg-error "already has basic type of" } + end function ! { dg-error "Expecting END INTERFACE statement" } + end interface + + interface + function C () + real :: C + end function + end interface + real :: C ! { dg-error "already has basic type of" } + + real :: D + interface + function D () + real :: D ! { dg-error "already has basic type of" } + end function + end interface + + interface + function E () result (s) + real ::s + end function + end interface + real :: E ! { dg-error "already has basic type of" } + + real :: F + interface + function F () result (s) + real ::s ! { dg-error "already has basic type of" } + end function F + end interface + +end + diff --git a/gcc/testsuite/gfortran.dg/func_decl_2.f90 b/gcc/testsuite/gfortran.dg/func_decl_2.f90 index c2cc4403cd6..658883e65e2 100644 --- a/gcc/testsuite/gfortran.dg/func_decl_2.f90 +++ b/gcc/testsuite/gfortran.dg/func_decl_2.f90 @@ -1,8 +1,6 @@ ! { dg-do compile } ! Test fix for PR16943 in which the double typing of -! N caused an error. This is a common extension to the -! F95 standard, so the error is only thrown for -std=f95 -! or -pedantic. +! N caused an error. ! ! Contributed by Paul Thomas <pault@gcc.gnu.org> ! @@ -14,7 +12,7 @@ integer function bugf(M) result (N) integer, intent (in) :: M - integer :: N ! { dg-warning "already has basic type of INTEGER" } + integer :: N ! { dg-error "already has basic type of INTEGER" } N = M return end function bugf diff --git a/gcc/testsuite/gfortran.dg/hollerith.f90 b/gcc/testsuite/gfortran.dg/hollerith.f90 index f9836155b57..21cbf66bdf6 100644 --- a/gcc/testsuite/gfortran.dg/hollerith.f90 +++ b/gcc/testsuite/gfortran.dg/hollerith.f90 @@ -99,10 +99,4 @@ end subroutine ! { dg-warning "Non-character in FORMAT tag" "" { target *-*-* } 39 } -! { dg-warning "Character array in FORMAT tag" "" { target *-*-* } 43 } - -! { dg-warning "Character array in FORMAT tag" "" { target *-*-* } 45 } - -! { dg-warning "Character array in FORMAT tag" "" { target *-*-* } 47 } - ! { dg-warning "Hollerith constant" "" { target *-*-* } 51 } diff --git a/gcc/testsuite/gfortran.dg/hollerith6.f90 b/gcc/testsuite/gfortran.dg/hollerith6.f90 new file mode 100644 index 00000000000..93e857dd511 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/hollerith6.f90 @@ -0,0 +1,35 @@ +! PR fortran/39865 +! { dg-do run } + +subroutine foo (a) + integer(kind=4) :: a(1, 3) + character(len=40) :: t + write (t, fmt=a(1,2)) 1, 2, 3, 4, 5, 6, 7, 8 + if (t .ne. ' 1 2 3 4 5 6 7 8') call abort +end subroutine foo + interface + subroutine foo (a) + integer(kind=4) :: a(1, 3) + end subroutine foo + end interface + integer(kind=4) :: b(1,3) + character(len=40) :: t + b(1,1) = 4HXXXX + b(1,2) = 4H (8I + b(1,3) = 2H4) + write (t, fmt=b(1,2)) 1, 2, 3, 4, 5, 6, 7, 8 + if (t .ne. ' 1 2 3 4 5 6 7 8') call abort + call foo (b) +end + +! { dg-warning "Non-character in FORMAT tag" "FMT" { target *-*-* } 7 } +! { dg-warning "Non-character in FORMAT tag" "FMT" { target *-*-* } 20 } + +! { dg-warning "Hollerith constant" "const" { target *-*-* } 17 } +! { dg-warning "Conversion" "conversion" { target *-*-* } 17 } + +! { dg-warning "Hollerith constant" "const" { target *-*-* } 18 } +! { dg-warning "Conversion" "conversion" { target *-*-* } 18 } + +! { dg-warning "Hollerith constant" "const" { target *-*-* } 19 } +! { dg-warning "Conversion" "conversion" { target *-*-* } 19 } diff --git a/gcc/testsuite/gfortran.dg/hollerith7.f90 b/gcc/testsuite/gfortran.dg/hollerith7.f90 new file mode 100644 index 00000000000..8e2fb4fec12 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/hollerith7.f90 @@ -0,0 +1,52 @@ +! PR fortran/39865 +! { dg-do compile } + +subroutine foo (a) + integer(kind=4), target :: a(1:, 1:) + integer(kind=4), pointer :: b(:, :) + b => a + write (*, fmt=a(1,2)) 1, 2, 3, 4, 5, 6, 7, 8 + write (*, fmt=b(1,2)) 1, 2, 3, 4, 5, 6, 7, 8 +end subroutine foo +subroutine bar (a, b) + character :: b(2,*) + integer :: a(*) + write (*, fmt=b) 1, 2, 3 + write (*, fmt=a) 1, 2, 3 + write (*, fmt=a(2)) 1, 2, 3 +end subroutine + interface + subroutine foo (a) + integer(kind=4), target :: a(:, :) + end subroutine foo + end interface + integer(kind=4) :: a(2, 3) + a = 4HXXXX + a(2,2) = 4H (8I + a(1,3) = 2H4) + a(2,3) = 1H + call foo (a(2:2,:)) +end + +! { dg-warning "Non-character in FORMAT tag" "FMT" { target *-*-* } 8 } +! { dg-error "Non-character assumed shape array element in FORMAT tag" "element" { target *-*-* } 8 } + +! { dg-warning "Non-character in FORMAT tag" "FMT" { target *-*-* } 9 } +! { dg-error "Non-character pointer array element in FORMAT tag" "element" { target *-*-* } 9 } + +! { dg-error "reference to the assumed size array" "assumed-size" { target *-*-* } 14 } +! { dg-error "reference to the assumed size array" "assumed-size" { target *-*-* } 15 } +! { dg-warning "Non-character in FORMAT tag" "FMT" { target *-*-* } 16 } +! { dg-error "Non-character assumed size array element in FORMAT tag" "element" { target *-*-* } 16 } + +! { dg-warning "Hollerith constant" "const" { target *-*-* } 24 } +! { dg-warning "Conversion" "conversion" { target *-*-* } 24 } + +! { dg-warning "Hollerith constant" "const" { target *-*-* } 25 } +! { dg-warning "Conversion" "conversion" { target *-*-* } 25 } + +! { dg-warning "Hollerith constant" "const" { target *-*-* } 26 } +! { dg-warning "Conversion" "conversion" { target *-*-* } 26 } + +! { dg-warning "Hollerith constant" "const" { target *-*-* } 27 } +! { dg-warning "Conversion" "conversion" { target *-*-* } 27 } diff --git a/gcc/testsuite/gfortran.dg/hollerith_f95.f90 b/gcc/testsuite/gfortran.dg/hollerith_f95.f90 index 1ba74036c26..4d7fda8c72e 100644 --- a/gcc/testsuite/gfortran.dg/hollerith_f95.f90 +++ b/gcc/testsuite/gfortran.dg/hollerith_f95.f90 @@ -91,10 +91,3 @@ end subroutine ! { dg-error "Non-character in FORMAT tag" "" { target *-*-* } 38 } ! { dg-error "Non-character in FORMAT tag" "" { target *-*-* } 40 } - -! { dg-error "Character array in FORMAT tag" "" { target *-*-* } 44 } - -! { dg-error "Character array in FORMAT tag" "" { target *-*-* } 46 } - -! { dg-error "Character array in FORMAT tag" "" { target *-*-* } 48 } - diff --git a/gcc/testsuite/gfortran.dg/interop_params.f03 b/gcc/testsuite/gfortran.dg/interop_params.f03 index 96c7d5cef16..ea3dadac040 100644 --- a/gcc/testsuite/gfortran.dg/interop_params.f03 +++ b/gcc/testsuite/gfortran.dg/interop_params.f03 @@ -14,7 +14,7 @@ contains end subroutine test_0 subroutine test_1(my_f90_real) bind(c) - real(c_int), value :: my_f90_real ! { dg-error "is for type INTEGER" } + real(c_int), value :: my_f90_real ! { dg-warning "is for type INTEGER" } end subroutine test_1 subroutine test_2(my_type) bind(c) ! { dg-error "is not C interoperable" } diff --git a/gcc/testsuite/gfortran.dg/pr39865.f90 b/gcc/testsuite/gfortran.dg/pr39865.f90 new file mode 100644 index 00000000000..fac34367422 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr39865.f90 @@ -0,0 +1,84 @@ +! PR fortran/39865 +! { dg-do run } + +subroutine f1 (a) + character(len=1) :: a(7:) + character(len=12) :: b + character(len=1) :: c(2:10) + write (b, a) 'Hell', 'o wo', 'rld!' + if (b .ne. 'Hello world!') call abort + write (b, a(:)) 'hell', 'o Wo', 'rld!' + if (b .ne. 'hello World!') call abort + write (b, a(8:)) 'Hell', 'o wo', 'rld!' + if (b .ne. 'Hello world!') call abort + c(2) = ' ' + c(3) = '(' + c(4) = '3' + c(5) = 'A' + c(6) = '4' + c(7) = ')' + write (b, c) 'hell', 'o Wo', 'rld!' + if (b .ne. 'hello World!') call abort + write (b, c(:)) 'Hell', 'o wo', 'rld!' + if (b .ne. 'Hello world!') call abort + write (b, c(3:)) 'hell', 'o Wo', 'rld!' + if (b .ne. 'hello World!') call abort +end subroutine f1 + +subroutine f2 (a) + character(len=1) :: a(10:,20:) + character(len=12) :: b + write (b, a) 'Hell', 'o wo', 'rld!' + if (b .ne. 'Hello world!') call abort + write (b, a) 'hell', 'o Wo', 'rld!' + if (b .ne. 'hello World!') call abort +end subroutine f2 + +function f3 () + character(len=1) :: f3(5) + f3(1) = '(' + f3(2) = '3' + f3(3) = 'A' + f3(4) = '4' + f3(5) = ')' +end function f3 + + interface + subroutine f1 (a) + character(len=1) :: a(:) + end + end interface + interface + subroutine f2 (a) + character(len=1) :: a(:,:) + end + end interface + interface + function f3 () + character(len=1) :: f3(5) + end + end interface + integer :: i, j + character(len=1) :: e (6, 7:9), f (3,2), g (10) + character(len=12) :: b + e = 'X' + e(2,8) = ' ' + e(3,8) = '(' + e(4,8) = '3' + e(2,9) = 'A' + e(3,9) = '4' + e(4,9) = ')' + f = e(2:4,8:9) + g = 'X' + g(2) = ' ' + g(3) = '(' + g(4) = '3' + g(5) = 'A' + g(6) = '4' + g(7) = ')' + call f1 (g(2:7)) + call f2 (f) + call f2 (e(2:4,8:9)) + write (b, f3 ()) 'Hell', 'o wo', 'rld!' + if (b .ne. 'Hello world!') call abort +end diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_comp_7.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_comp_7.f90 new file mode 100644 index 00000000000..860c2dd9b81 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/proc_ptr_comp_7.f90 @@ -0,0 +1,40 @@ +! { dg-do compile } +! +! PR 40089: Public type with public component which has a private type +! +! Original test case by Juergen Reuter <reuter@physik.uni-freiburg.de> +! Adapted by Janus Weil <janus@gcc.gnu.org> + +module m + + implicit none + private + + public :: public_t + + type :: private_t + integer :: i + end type + + type :: public_t + type(private_t), pointer :: public_comp_with_private_type + procedure(ifc) , nopass, pointer :: ppc + end type + + abstract interface + integer function ifc () + end function + end interface + +end module m + +program test +use m +implicit none +type(public_t) :: x +integer :: j +j = x%ppc() +end + +! { dg-final { cleanup-modules "m" } } + diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 92bde7886a9..56f7877dd18 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -466,6 +466,11 @@ proc check_profiling_available { test_what } { return 0 } + # cygwin does not support -p. + if { [istarget *-*-cygwin*] && [lindex $test_what 1] == "-p" } { + return 0 + } + # uClibc does not have gcrt1.o. if { [check_effective_target_uclibc] && ([lindex $test_what 1] == "-p" |