summaryrefslogtreecommitdiff
path: root/gcc/fortran/intrinsic.texi
diff options
context:
space:
mode:
authorburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>2014-05-25 05:24:12 +0000
committerburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>2014-05-25 05:24:12 +0000
commit3427a543a37cc70f4809a7a838527411f9afaee1 (patch)
tree674a166546a3e633ac9d67036605b32fa986ed8b /gcc/fortran/intrinsic.texi
parent4f78e0a8f9c3a58c3c5566c6b1a0e5acceac8924 (diff)
downloadgcc-3427a543a37cc70f4809a7a838527411f9afaee1.tar.gz
2014-05-25 Tobias Burnus <burnus@net-b.de>
* check.c (gfc_check_num_images): New. (gfc_check_this_image): Handle distance argument. * intrinsic.c (add_functions): Update this_image and num_images for new distance and failed arguments. * intrinsic.texi (THIS_IMAGE, NUM_IMAGES): Document the new arguments. * intrinsic.h (gfc_check_num_images): New. (gfc_check_this_image, gfc_simplify_num_images, gfc_simplify_this_image, gfc_resolve_this_image): Update prototype. * iresolve.c (gfc_resolve_this_image): Handle distance argument. * simplify.c (gfc_simplify_num_images, gfc_simplify_this_image): Handle new arguments. * trans-intrinsic.c (trans_this_image, trans_num_images): Ditto. (gfc_conv_intrinsic_function): Update trans_num_images call. 2014-05-25 Tobias Burnus <burnus@net-b.de> * gfortran.dg/coarray_10.f90: Update dg-warning. * gfortran.dg/coarray_this_image_1.f90: New. * gfortran.dg/coarray_this_image_2.f90: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@210909 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/intrinsic.texi')
-rw-r--r--gcc/fortran/intrinsic.texi49
1 files changed, 38 insertions, 11 deletions
diff --git a/gcc/fortran/intrinsic.texi b/gcc/fortran/intrinsic.texi
index b091ee4c9b4..776cb00bf11 100644
--- a/gcc/fortran/intrinsic.texi
+++ b/gcc/fortran/intrinsic.texi
@@ -9676,18 +9676,32 @@ REAL, POINTER, DIMENSION(:) :: VEC => NULL ()
Returns the number of images.
@item @emph{Standard}:
-Fortran 2008 and later
+Fortran 2008 and later. With @var{DISTANCE} or @var{FAILED} argument,
+Technical Specification (TS) 18508 or later
+
@item @emph{Class}:
Transformational function
@item @emph{Syntax}:
-@code{RESULT = NUM_IMAGES()}
+@code{RESULT = NUM_IMAGES(DISTANCE, FAILED)}
-@item @emph{Arguments}: None.
+@item @emph{Arguments}:
+@multitable @columnfractions .15 .70
+@item @var{DISTANCE} @tab (optional, intent(in)) Nonnegative scalar integer
+@item @var{FAILED} @tab (optional, intent(in)) Scalar logical expression
+@end multitable
@item @emph{Return value}:
-Scalar default-kind integer.
+Scalar default-kind integer. If @var{DISTANCE} is not present or has value 0,
+the number of images in the current team is returned. For values smaller or
+equal distance to the initial team, it returns the number of images index
+on the ancestor team which has a distance of @var{DISTANCE} from the invoking
+team. If @var{DISTANCE} is larger than the distance to the initial team, the
+number of images of the initial team is returned. If @var{FAILED} is not present
+the total number of images is returned; if it has the value @code{.TRUE.},
+the number of failed images is returned, otherwise, the number of images which
+do have not the failed status.
@item @emph{Example}:
@smallexample
@@ -12422,7 +12436,8 @@ end program test_tanh
Returns the cosubscript for this image.
@item @emph{Standard}:
-Fortran 2008 and later
+Fortran 2008 and later. With @var{DISTANCE} argument,
+Technical Specification (TS) 18508 or later
@item @emph{Class}:
Transformational function
@@ -12430,11 +12445,14 @@ Transformational function
@item @emph{Syntax}:
@multitable @columnfractions .80
@item @code{RESULT = THIS_IMAGE()}
+@item @code{RESULT = THIS_IMAGE(DISTANCE)}
@item @code{RESULT = THIS_IMAGE(COARRAY [, DIM])}
@end multitable
@item @emph{Arguments}:
@multitable @columnfractions .15 .70
+@item @var{DISTANCE} @tab (optional, intent(in)) Nonnegative scalar integer
+(not permitted together with @var{COARRAY}).
@item @var{COARRAY} @tab Coarray of any type (optional; if @var{DIM}
present, required).
@item @var{DIM} @tab default integer scalar (optional). If present,
@@ -12443,12 +12461,17 @@ present, required).
@item @emph{Return value}:
-Default integer. If @var{COARRAY} is not present, it is scalar and its value
-is the index of the invoking image. Otherwise, if @var{DIM} is not present,
-a rank-1 array with corank elements is returned, containing the cosubscripts
-for @var{COARRAY} specifying the invoking image. If @var{DIM} is present,
-a scalar is returned, with the value of the @var{DIM} element of
-@code{THIS_IMAGE(COARRAY)}.
+Default integer. If @var{COARRAY} is not present, it is scalar; if
+@var{DISTANCE} is not present or has value 0, its value is the image index on
+the invoking image for the current team, for values smaller or equal
+distance to the initial team, it returns the image index on the ancestor team
+which has a distance of @var{DISTANCE} from the invoking team. If
+@var{DISTANCE} is larger than the distance to the initial team, the image
+index of the initial team is returned. Otherwise when the @var{COARRAY} is
+present, if @var{DIM} is not present, a rank-1 array with corank elements is
+returned, containing the cosubscripts for @var{COARRAY} specifying the invoking
+image. If @var{DIM} is present, a scalar is returned, with the value of
+the @var{DIM} element of @code{THIS_IMAGE(COARRAY)}.
@item @emph{Example}:
@smallexample
@@ -12461,6 +12484,10 @@ IF (THIS_IMAGE() == 1) THEN
WRITE(*,'(2(a,i0))') 'value[', i, '] is ', value[i]
END DO
END IF
+
+! Check whether the current image is the initial image
+IF (THIS_IMAGE(HUGE(1)) /= THIS_IMAGE())
+ error stop "something is rotten here"
@end smallexample
@item @emph{See also}: