PR fortran/18918
* array.c (gfc_match_array_spec): Add error for -fcoarray=none.
* match.c (gfc_match_critical, sync_statement): Ditto.
* gfortran.h (gfc_fcoarray): New enum.
(gfc_option_t): Use it.
* lang.opt (fcoarray): Add new flag.
* invoke.texi (fcoarray): Document it.
* options.c (gfc_init_options,gfc_handle_option): Handle
* -fcoarray=.
(gfc_handle_coarray_option): New function.
2010-04-06 Tobias Burnus <burnus@net-b.de>
PR fortran/18918
* gfortran.dg/coarray_2.f90: Add dg-options -fcoarray=single.
* gfortran.dg/coarray_3.f90: Ditto.
* gfortran.dg/coarray_4.f90: Ditto.
* gfortran.dg/coarray_5.f90: Ditto.
* gfortran.dg/coarray_6.f90: Ditto.
* gfortran.dg/coarray_7.f90: Ditto.
* gfortran.dg/coarray_8.f90: Ditto.
* gfortran.dg/coarray_9.f90: New -fcoarray=none test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158016
138bc75d-0d04-0410-961f-
82ee72b054a4
2010-04-06 Tobias Burnus <burnus@net-b.de>
PR fortran/18918
+ * array.c (gfc_match_array_spec): Add error for -fcoarray=none.
+ * match.c (gfc_match_critical, sync_statement): Ditto.
+ * gfortran.h (gfc_fcoarray): New enum.
+ (gfc_option_t): Use it.
+ * lang.opt (fcoarray): Add new flag.
+ * invoke.texi (fcoarray): Document it.
+ * options.c (gfc_init_options,gfc_handle_option): Handle -fcoarray=.
+ (gfc_handle_coarray_option): New function.
+
+2010-04-06 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/18918
* gfortran.h (gfc_array_spec): Add cotype.
* array.c (gfc_match_array_spec,gfc_set_array_spec): Use it
and defer error diagnostic.
== FAILURE)
goto cleanup;
+ if (gfc_option.coarray == GFC_FCOARRAY_NONE)
+ {
+ gfc_error ("Coarrays disabled at %C, use -fcoarray= to enable");
+ goto cleanup;
+ }
+
for (;;)
{
as->corank++;
}
init_local_integer;
+typedef enum
+{
+ GFC_FCOARRAY_NONE = 0,
+ GFC_FCOARRAY_SINGLE
+}
+gfc_fcoarray;
+
/************************* Structures *****************************/
/* Used for keeping things in balanced binary trees. */
int fpe;
int rtcheck;
+ gfc_fcoarray coarray;
int warn_std;
int allow_std;
@gccoptlist{-fno-automatic -ff2c -fno-underscoring @gol
-fwhole-file -fsecond-underscore @gol
-fbounds-check -fcheck-array-temporaries -fmax-array-constructor =@var{n} @gol
--fcheck=@var{<all|array-temps|bounds|do|mem|pointer|recursion>}
--fmax-stack-var-size=@var{n} @gol
+-fcheck=@var{<all|array-temps|bounds|do|mem|pointer|recursion>} @gol
+-fcoarray=@var{<none|single>} -fmax-stack-var-size=@var{n} @gol
-fpack-derived -frepack-arrays -fshort-enums -fexternal-blas @gol
-fblas-matmul-limit=@var{n} -frecursive -finit-local-zero @gol
-finit-integer=@var{n} -finit-real=@var{<zero|inf|-inf|nan|snan>} @gol
for compatibility with @command{g77} and @command{f2c}, and is implied
by use of the @option{-ff2c} option.
+@item -fcoarray=@var{<keyword>}
+@opindex @code{fcoarray}
+@cindex coarrays
+
+@table @asis
+@item @samp{none}
+Disable coarray support; using coarray declarations and image-control
+statements will produce a compile-time error. (Default)
+
+@item @samp{single}
+Single-image mode, i.e. @code{num_images()} is always one.
+@end table
+
+
@item -fcheck=@var{<keyword>}
@opindex @code{fcheck}
@cindex array, bounds checking
Fortran
Copy array sections into a contiguous block on procedure entry
+fcoarray=
+Fortran RejectNegative JoinedOrMissing
+-fcoarray=[...] Specify which coarray parallelization should be used
+
fcheck=
Fortran RejectNegative JoinedOrMissing
-fcheck=[...] Specify which runtime checks are to be performed
== FAILURE)
return MATCH_ERROR;
+ if (gfc_option.coarray == GFC_FCOARRAY_NONE)
+ {
+ gfc_error ("Coarrays disabled at %C, use -fcoarray= to enable");
+ return MATCH_ERROR;
+ }
+
if (gfc_find_state (COMP_CRITICAL) == SUCCESS)
{
gfc_error ("Nested CRITICAL block at %C");
== FAILURE)
return MATCH_ERROR;
+ if (gfc_option.coarray == GFC_FCOARRAY_NONE)
+ {
+ gfc_error ("Coarrays disabled at %C, use -fcoarray= to enable");
+ return MATCH_ERROR;
+ }
+
if (gfc_find_state (COMP_CRITICAL) == SUCCESS)
{
gfc_error ("Image control statement SYNC at %C in CRITICAL block");
gfc_option.fpe = 0;
gfc_option.rtcheck = 0;
+ gfc_option.coarray = GFC_FCOARRAY_NONE;
/* Argument pointers cannot point to anything but their argument. */
flag_argument_noalias = 3;
static void
+gfc_handle_coarray_option (const char *arg)
+{
+ if (strcmp (arg, "none") == 0)
+ gfc_option.coarray = GFC_FCOARRAY_NONE;
+ else if (strcmp (arg, "single") == 0)
+ gfc_option.coarray = GFC_FCOARRAY_SINGLE;
+ else
+ gfc_fatal_error ("Argument to -fcoarray is not valid: %s", arg);
+}
+
+
+static void
gfc_handle_runtime_check_option (const char *arg)
{
int result, pos = 0, n;
gfc_handle_runtime_check_option (arg);
break;
+ case OPT_fcoarray_:
+ gfc_handle_coarray_option (arg);
+ break;
}
return result;
2010-04-06 Tobias Burnus <burnus@net-b.de>
PR fortran/18918
+ * gfortran.dg/coarray_2.f90: Add dg-options -fcoarray=single.
+ * gfortran.dg/coarray_3.f90: Ditto.
+ * gfortran.dg/coarray_4.f90: Ditto.
+ * gfortran.dg/coarray_5.f90: Ditto.
+ * gfortran.dg/coarray_6.f90: Ditto.
+ * gfortran.dg/coarray_9.f90: New -fcoarray=none test.
+
+2010-04-06 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/18918
* gfortran.dg/coarray_4.f90: Fix test.
* gfortran.dg/coarray_6.f90: Add more tests.
! { dg-do run }
+! { dg-options "-fcoarray=single" }
! { dg-shouldfail "error stop" }
!
! Coarray support
! { dg-do compile }
+! { dg-options "-fcoarray=single" }
!
! Coarray support
! PR fortran/18918
! { dg-do compile }
+! { dg-options "-fcoarray=single" }
!
! Coarray support -- corank declarations
! PR fortran/18918
! { dg-do compile }
+! { dg-options "-fcoarray=single" }
!
! Coarray support -- corank declarations
! PR fortran/18918
--- /dev/null
+! { dg-do compile }
+!
+! PR fortran/18918
+!
+! Check for error if no -fcoarray= option has been given
+!
+
+integer :: a
+integer :: b[*] ! { dg-error "Coarrays disabled" }
+
+error stop "Error"
+sync all ! { dg-error "Coarrays disabled" }
+
+critical ! { dg-error "Coarrays disabled" }
+end critical ! { dg-error "Expecting END PROGRAM statement" }
+
+end