Re: [PATCH, Fortran, Coarray, v1] Add support for failed images

2017-03-09 Thread Andre Vehreschild
Hi Christophe,

The testcase is not expected to output anything. So only the exit code should 
be set to zero. I called libgfortrans exit-function to quit the program. I am 
not aware that I need to do more. Happy for any insight what goes wrong. There 
are also issues on hpux, but I think they have a different cause.

- Andre

Am 10. März 2017 07:48:12 MEZ schrieb Christophe Lyon 
:
>On 9 March 2017 at 09:45, Andre Vehreschild  wrote:
>> Hi Christophe,
>>
>> you are right, that error message does not help a bit. Can you
>manually compile
>> and execute the testcase? Does it print "ERROR STOP: This statement
>should not
>> be reached."?
>>
>> If not what does
>>
>> fail_image_2 && echo "yes" || echo "no"
>>
>> print? It should be "yes"
>>
>
>I restarted the build manually, and the program exits without printing
>anything, and the return code is 0.
>
>What is missing in gfortran.log is the "EXIT code 0" string.
>It looks like an unexpected interaction between qemu and
>the way the program exists, meaning that the exit code
>is not properly detected by dejagnu.
>I'll try to debug that, it looks like a setting is missing in
>my validation environment.
>
>Thanks,
>
>Christophe
>
>> - Andre
>>
>> On Wed, 8 Mar 2017 23:58:10 +0100
>> Christophe Lyon  wrote:
>>
>>> Hi,
>>>
>>> On 5 March 2017 at 12:41, Andre Vehreschild  wrote:
>>> > Hi Jerry,
>>> >
>>> > thanks for seconding my read of the standard and reviewing so
>quickly.
>>> > Committed as r245900.
>>> >
>>>
>>> I've noticed that the new test:
>>> gfortran.dg/coarray/fail_image_2.f08 -fcoarray=single  -O2  -latomic
>>> execution test
>>> fails on arm and aarch64.
>>> I'm using qemu if it matters, and my gfortran.log has:
>>> spawn /XXX/qemu-wrapper.sh ./fail_image_2.exe
>>> FAIL: gfortran.dg/coarray/fail_image_2.f08 -fcoarray=single  -O2
>>> -latomic execution test
>>>
>>> that is, no obvious error message :-(
>>>
>>> Am I the only one seeing this?
>>>
>>> Thanks,
>>>
>>> Christophe
>>>
>>> > Regards,
>>> > Andre
>>> >
>>> > On Sat, 4 Mar 2017 15:06:25 -0800
>>> > Jerry DeLisle  wrote:
>>> >
>>> >> On 03/04/2017 09:58 AM, Andre Vehreschild wrote:
>>> >> > Hi all,
>>> >> >
>>> >> > attached patch polishes the one begun by Alessandro. It adds
>>> >> > documentation and fixes the style issues. Furthermore did I try
>to
>>> >> > interpret the standard according to the FAIL IMAGE statement.
>IMHO
>>> >> > should it just quit the executable without any error code. The
>>> >> > caf_single library emits "FAIL IMAGE" to stderr, while in
>coarray=single
>>> >> > mode it just quits. What do you think?
>>> >> >
>>> >> > Bootstraps and regtests ok on x86_64-linux/f25. Ok for trunk?
>(May be
>>> >> > later).
>>> >> >
>>> >> > Gruß,
>>> >> > Andre
>>> >> >
>>> >>
>>> >> From my read:
>>> >>
>>> >> "A failed image is usually associated with a hardware failure of
>the
>>> >> processor, memory system, or interconnection network"
>>> >>
>>> >> Since the FAIL IMAGE statement is intended to simulate such
>failure, I
>>> >> agree with your interpretation as well, it just stops execution.
>>> >>
>>> >> Yes OK for trunk now.
>>> >>
>>> >> Jerry
>>> >
>>> >
>>> > --
>>> > Andre Vehreschild * Email: vehre ad gmx dot de
>>
>>
>> --
>> Andre Vehreschild * Email: vehre ad gmx dot de

-- 
Andre Vehreschild * Kreuzherrenstr. 8 * 52062 Aachen
Tel.: +49 241 929 10 18 * ve...@gmx.de


Re: [PATCH, Fortran, Coarray, v1] Add support for failed images

2017-03-09 Thread Christophe Lyon
On 9 March 2017 at 09:45, Andre Vehreschild  wrote:
> Hi Christophe,
>
> you are right, that error message does not help a bit. Can you manually 
> compile
> and execute the testcase? Does it print "ERROR STOP: This statement should not
> be reached."?
>
> If not what does
>
> fail_image_2 && echo "yes" || echo "no"
>
> print? It should be "yes"
>

I restarted the build manually, and the program exits without printing
anything, and the return code is 0.

What is missing in gfortran.log is the "EXIT code 0" string.
It looks like an unexpected interaction between qemu and
the way the program exists, meaning that the exit code
is not properly detected by dejagnu.
I'll try to debug that, it looks like a setting is missing in
my validation environment.

Thanks,

Christophe

> - Andre
>
> On Wed, 8 Mar 2017 23:58:10 +0100
> Christophe Lyon  wrote:
>
>> Hi,
>>
>> On 5 March 2017 at 12:41, Andre Vehreschild  wrote:
>> > Hi Jerry,
>> >
>> > thanks for seconding my read of the standard and reviewing so quickly.
>> > Committed as r245900.
>> >
>>
>> I've noticed that the new test:
>> gfortran.dg/coarray/fail_image_2.f08 -fcoarray=single  -O2  -latomic
>> execution test
>> fails on arm and aarch64.
>> I'm using qemu if it matters, and my gfortran.log has:
>> spawn /XXX/qemu-wrapper.sh ./fail_image_2.exe
>> FAIL: gfortran.dg/coarray/fail_image_2.f08 -fcoarray=single  -O2
>> -latomic execution test
>>
>> that is, no obvious error message :-(
>>
>> Am I the only one seeing this?
>>
>> Thanks,
>>
>> Christophe
>>
>> > Regards,
>> > Andre
>> >
>> > On Sat, 4 Mar 2017 15:06:25 -0800
>> > Jerry DeLisle  wrote:
>> >
>> >> On 03/04/2017 09:58 AM, Andre Vehreschild wrote:
>> >> > Hi all,
>> >> >
>> >> > attached patch polishes the one begun by Alessandro. It adds
>> >> > documentation and fixes the style issues. Furthermore did I try to
>> >> > interpret the standard according to the FAIL IMAGE statement. IMHO
>> >> > should it just quit the executable without any error code. The
>> >> > caf_single library emits "FAIL IMAGE" to stderr, while in coarray=single
>> >> > mode it just quits. What do you think?
>> >> >
>> >> > Bootstraps and regtests ok on x86_64-linux/f25. Ok for trunk? (May be
>> >> > later).
>> >> >
>> >> > Gruß,
>> >> > Andre
>> >> >
>> >>
>> >> From my read:
>> >>
>> >> "A failed image is usually associated with a hardware failure of the
>> >> processor, memory system, or interconnection network"
>> >>
>> >> Since the FAIL IMAGE statement is intended to simulate such failure, I
>> >> agree with your interpretation as well, it just stops execution.
>> >>
>> >> Yes OK for trunk now.
>> >>
>> >> Jerry
>> >
>> >
>> > --
>> > Andre Vehreschild * Email: vehre ad gmx dot de
>
>
> --
> Andre Vehreschild * Email: vehre ad gmx dot de


Re: [PATCH, Fortran, Coarray, v1] Add support for failed images

2017-03-09 Thread Andre Vehreschild
Hi Christophe,

you are right, that error message does not help a bit. Can you manually compile
and execute the testcase? Does it print "ERROR STOP: This statement should not
be reached."? 

If not what does

fail_image_2 && echo "yes" || echo "no" 

print? It should be "yes"

- Andre

On Wed, 8 Mar 2017 23:58:10 +0100
Christophe Lyon  wrote:

> Hi,
> 
> On 5 March 2017 at 12:41, Andre Vehreschild  wrote:
> > Hi Jerry,
> >
> > thanks for seconding my read of the standard and reviewing so quickly.
> > Committed as r245900.
> >  
> 
> I've noticed that the new test:
> gfortran.dg/coarray/fail_image_2.f08 -fcoarray=single  -O2  -latomic
> execution test
> fails on arm and aarch64.
> I'm using qemu if it matters, and my gfortran.log has:
> spawn /XXX/qemu-wrapper.sh ./fail_image_2.exe
> FAIL: gfortran.dg/coarray/fail_image_2.f08 -fcoarray=single  -O2
> -latomic execution test
> 
> that is, no obvious error message :-(
> 
> Am I the only one seeing this?
> 
> Thanks,
> 
> Christophe
> 
> > Regards,
> > Andre
> >
> > On Sat, 4 Mar 2017 15:06:25 -0800
> > Jerry DeLisle  wrote:
> >  
> >> On 03/04/2017 09:58 AM, Andre Vehreschild wrote:  
> >> > Hi all,
> >> >
> >> > attached patch polishes the one begun by Alessandro. It adds
> >> > documentation and fixes the style issues. Furthermore did I try to
> >> > interpret the standard according to the FAIL IMAGE statement. IMHO
> >> > should it just quit the executable without any error code. The
> >> > caf_single library emits "FAIL IMAGE" to stderr, while in coarray=single
> >> > mode it just quits. What do you think?
> >> >
> >> > Bootstraps and regtests ok on x86_64-linux/f25. Ok for trunk? (May be
> >> > later).
> >> >
> >> > Gruß,
> >> > Andre
> >> >  
> >>
> >> From my read:
> >>
> >> "A failed image is usually associated with a hardware failure of the
> >> processor, memory system, or interconnection network"
> >>
> >> Since the FAIL IMAGE statement is intended to simulate such failure, I
> >> agree with your interpretation as well, it just stops execution.
> >>
> >> Yes OK for trunk now.
> >>
> >> Jerry  
> >
> >
> > --
> > Andre Vehreschild * Email: vehre ad gmx dot de  


-- 
Andre Vehreschild * Email: vehre ad gmx dot de 


Re: [PATCH, Fortran, Coarray, v1] Add support for failed images

2017-03-08 Thread Christophe Lyon
Hi,

On 5 March 2017 at 12:41, Andre Vehreschild  wrote:
> Hi Jerry,
>
> thanks for seconding my read of the standard and reviewing so quickly.
> Committed as r245900.
>

I've noticed that the new test:
gfortran.dg/coarray/fail_image_2.f08 -fcoarray=single  -O2  -latomic
execution test
fails on arm and aarch64.
I'm using qemu if it matters, and my gfortran.log has:
spawn /XXX/qemu-wrapper.sh ./fail_image_2.exe
FAIL: gfortran.dg/coarray/fail_image_2.f08 -fcoarray=single  -O2
-latomic execution test

that is, no obvious error message :-(

Am I the only one seeing this?

Thanks,

Christophe

> Regards,
> Andre
>
> On Sat, 4 Mar 2017 15:06:25 -0800
> Jerry DeLisle  wrote:
>
>> On 03/04/2017 09:58 AM, Andre Vehreschild wrote:
>> > Hi all,
>> >
>> > attached patch polishes the one begun by Alessandro. It adds documentation
>> > and fixes the style issues. Furthermore did I try to interpret the standard
>> > according to the FAIL IMAGE statement. IMHO should it just quit the
>> > executable without any error code. The caf_single library emits "FAIL
>> > IMAGE" to stderr, while in coarray=single mode it just quits. What do you
>> > think?
>> >
>> > Bootstraps and regtests ok on x86_64-linux/f25. Ok for trunk? (May be
>> > later).
>> >
>> > Gruß,
>> > Andre
>> >
>>
>> From my read:
>>
>> "A failed image is usually associated with a hardware failure of the
>> processor, memory system, or interconnection network"
>>
>> Since the FAIL IMAGE statement is intended to simulate such failure, I agree
>> with your interpretation as well, it just stops execution.
>>
>> Yes OK for trunk now.
>>
>> Jerry
>
>
> --
> Andre Vehreschild * Email: vehre ad gmx dot de


Re: [PATCH, Fortran, Coarray, v1] Add support for failed images

2017-03-05 Thread Andre Vehreschild
Hi Jerry,

thanks for seconding my read of the standard and reviewing so quickly.
Committed as r245900.

Regards,
Andre

On Sat, 4 Mar 2017 15:06:25 -0800
Jerry DeLisle  wrote:

> On 03/04/2017 09:58 AM, Andre Vehreschild wrote:
> > Hi all,
> > 
> > attached patch polishes the one begun by Alessandro. It adds documentation
> > and fixes the style issues. Furthermore did I try to interpret the standard
> > according to the FAIL IMAGE statement. IMHO should it just quit the
> > executable without any error code. The caf_single library emits "FAIL
> > IMAGE" to stderr, while in coarray=single mode it just quits. What do you
> > think?
> > 
> > Bootstraps and regtests ok on x86_64-linux/f25. Ok for trunk? (May be
> > later).
> > 
> > Gruß,
> > Andre
> >   
> 
> From my read:
> 
> "A failed image is usually associated with a hardware failure of the
> processor, memory system, or interconnection network"
> 
> Since the FAIL IMAGE statement is intended to simulate such failure, I agree
> with your interpretation as well, it just stops execution.
> 
> Yes OK for trunk now.
> 
> Jerry


-- 
Andre Vehreschild * Email: vehre ad gmx dot de 
Index: gcc/fortran/ChangeLog
===
--- gcc/fortran/ChangeLog	(Revision 245899)
+++ gcc/fortran/ChangeLog	(Arbeitskopie)
@@ -1,3 +1,51 @@
+2017-03-05  Andre Vehreschild  ,
+	Alessandro Fanfarillo  
+
+	* check.c (positive_check): Add new function checking constant for
+	being greater then zero.
+	(gfc_check_image_status): Add checking of image_status arguments.
+	(gfc_check_failed_or_stopped_images): Same but for failed_- and
+	stopped_images function.
+	* dump-parse-tree.c (show_code_node): Added output of FAIL IMAGE.
+	* gfortran.h (enum gfc_statement): Added FAIL_IMAGE_ST.
+	(enum gfc_isym_id): Added new intrinsic symbols.
+	(enum gfc_exec_op): Added EXEC_FAIL_IMAGE.
+	* gfortran.texi: Added description for the new API functions. Updated
+	coverage of gfortran of TS18508.
+	* intrinsic.c (add_functions): Added symbols to resolve new intrinsic
+	functions. 
+	* intrinsic.h: Added prototypes.
+	* iresolve.c (gfc_resolve_failed_images): Resolve the failed_images
+	intrinsic.
+	(gfc_resolve_image_status): Same for image_status.
+	(gfc_resolve_stopped_images): Same for stopped_images.
+	* libgfortran.h: Added prototypes.
+	* match.c (gfc_match_if): Added matching of FAIL IMAGE statement.
+	(gfc_match_fail_image): Match a FAIL IMAGE statement.
+	* match.h: Added prototype.
+	* parse.c (decode_statement): Added matching for FAIL IMAGE.
+	(next_statement): Same.
+	(gfc_ascii_statement): Same.
+	* resolve.c: Same.
+	* simplify.c (gfc_simplify_failed_or_stopped_images): For COARRAY=
+	single a constant result can be returne.d
+	(gfc_simplify_image_status): For COARRAY=single the result is constant.
+	* st.c (gfc_free_statement): Added FAIL_IMAGE handling.
+	* trans-decl.c (gfc_build_builtin_function_decls): Added decls of the
+	new intrinsics.
+	* trans-expr.c (gfc_conv_procedure_call): This is first time all
+	arguments of a function are optional, which is now handled here
+	correctly.
+	* trans-intrinsic.c (conv_intrinsic_image_status): Translate
+	image_status.
+	(gfc_conv_intrinsic_function): Add support for image_status.
+	(gfc_is_intrinsic_libcall): Add support for the remaining new
+	intrinsics.
+	* trans-stmt.c (gfc_trans_fail_image): Trans a fail image.
+	* trans-stmt.h: Add the prototype for the above.
+	* trans.c (trans_code): Dispatch for fail_image.
+	* trans.h: Add the trees for the new intrinsics.
+
 2017-03-03  Jerry DeLisle  
 
 	PR fortran/79841
Index: gcc/fortran/check.c
===
--- gcc/fortran/check.c	(Revision 245899)
+++ gcc/fortran/check.c	(Arbeitskopie)
@@ -295,6 +295,29 @@
 }
 
 
+/* If expr is a constant, then check to ensure that it is greater than zero.  */
+
+static bool
+positive_check (int n, gfc_expr *expr)
+{
+  int i;
+
+  if (expr->expr_type == EXPR_CONSTANT)
+{
+  gfc_extract_int (expr, );
+  if (i <= 0)
+	{
+	  gfc_error ("%qs argument of %qs intrinsic at %L must be positive",
+		 gfc_current_intrinsic_arg[n]->name, gfc_current_intrinsic,
+		 >where);
+	  return false;
+	}
+}
+
+  return true;
+}
+
+
 /* If expr2 is constant, then check that the value is less than
(less than or equal to, if 'or_equal' is true) bit_size(expr1).  */
 
@@ -1138,6 +1161,60 @@
 
 
 bool
+gfc_check_image_status (gfc_expr *image, gfc_expr *team)
+{
+  /* IMAGE has to be a positive, scalar integer.  */
+  if (!type_check (image, 0, BT_INTEGER) || !scalar_check (image, 0)
+  || !positive_check (0, image))
+return false;
+
+  if (team)
+{
+  gfc_error ("%qs argument of %qs intrinsic at %L not yet supported",
+		 gfc_current_intrinsic_arg[1]->name, gfc_current_intrinsic,
+		 >where);
+  return false;
+}

Re: [PATCH, Fortran, Coarray, v1] Add support for failed images

2017-03-04 Thread Jerry DeLisle
On 03/04/2017 09:58 AM, Andre Vehreschild wrote:
> Hi all,
> 
> attached patch polishes the one begun by Alessandro. It adds documentation and
> fixes the style issues. Furthermore did I try to interpret the standard
> according to the FAIL IMAGE statement. IMHO should it just quit the executable
> without any error code. The caf_single library emits "FAIL IMAGE" to stderr,
> while in coarray=single mode it just quits. What do you think?
> 
> Bootstraps and regtests ok on x86_64-linux/f25. Ok for trunk? (May be later).
> 
> Gruß,
>   Andre
> 

>From my read:

"A failed image is usually associated with a hardware failure of the processor,
memory system, or interconnection network"

Since the FAIL IMAGE statement is intended to simulate such failure, I agree
with your interpretation as well, it just stops execution.

Yes OK for trunk now.

Jerry


Re: [PATCH, Fortran, Coarray, v1] Add support for failed images

2017-03-04 Thread Andre Vehreschild
Hi Alessandro,

Yes of course. I planned to. Sorry that I forgot.

- Andre

Am 4. März 2017 20:51:58 MEZ schrieb Alessandro Fanfarillo 
:
>Hi Andre,
>thanks for your work on the patch. I agree with you about exit(0)
>statement in libcaf_single.
>Could you please add my name and contact (Alessandro Fanfarillo
>) below yours in the changelog?
>
>Thanks,
>Alessandro
>
>
>2017-03-04 10:58 GMT-07:00 Andre Vehreschild :
>> Hi all,
>>
>> attached patch polishes the one begun by Alessandro. It adds
>documentation and
>> fixes the style issues. Furthermore did I try to interpret the
>standard
>> according to the FAIL IMAGE statement. IMHO should it just quit the
>executable
>> without any error code. The caf_single library emits "FAIL IMAGE" to
>stderr,
>> while in coarray=single mode it just quits. What do you think?
>>
>> Bootstraps and regtests ok on x86_64-linux/f25. Ok for trunk? (May be
>later).
>>
>> Gruß,
>> Andre
>> --
>> Andre Vehreschild * Email: vehre ad gmx dot de

-- 
Andre Vehreschild * Kreuzherrenstr. 8 * 52062 Aachen
Tel.: +49 241 929 10 18 * ve...@gmx.de


Re: [PATCH, Fortran, Coarray, v1] Add support for failed images

2017-03-04 Thread Alessandro Fanfarillo
Hi Andre,
thanks for your work on the patch. I agree with you about exit(0)
statement in libcaf_single.
Could you please add my name and contact (Alessandro Fanfarillo
) below yours in the changelog?

Thanks,
Alessandro


2017-03-04 10:58 GMT-07:00 Andre Vehreschild :
> Hi all,
>
> attached patch polishes the one begun by Alessandro. It adds documentation and
> fixes the style issues. Furthermore did I try to interpret the standard
> according to the FAIL IMAGE statement. IMHO should it just quit the executable
> without any error code. The caf_single library emits "FAIL IMAGE" to stderr,
> while in coarray=single mode it just quits. What do you think?
>
> Bootstraps and regtests ok on x86_64-linux/f25. Ok for trunk? (May be later).
>
> Gruß,
> Andre
> --
> Andre Vehreschild * Email: vehre ad gmx dot de


[PATCH, Fortran, Coarray, v1] Add support for failed images

2017-03-04 Thread Andre Vehreschild
Hi all,

attached patch polishes the one begun by Alessandro. It adds documentation and
fixes the style issues. Furthermore did I try to interpret the standard
according to the FAIL IMAGE statement. IMHO should it just quit the executable
without any error code. The caf_single library emits "FAIL IMAGE" to stderr,
while in coarray=single mode it just quits. What do you think?

Bootstraps and regtests ok on x86_64-linux/f25. Ok for trunk? (May be later).

Gruß,
Andre
-- 
Andre Vehreschild * Email: vehre ad gmx dot de 
gcc/fortran/ChangeLog:

2017-03-04  Andre Vehreschild  

* check.c (positive_check): Add new function checking constant for
being greater then zero.
(gfc_check_image_status): Add checking of image_status arguments.
(gfc_check_failed_or_stopped_images): Same but for failed_- and
stopped_images function.
* dump-parse-tree.c (show_code_node): Added output of FAIL IMAGE.
* gfortran.h (enum gfc_statement): Added FAIL_IMAGE_ST.
(enum gfc_isym_id): Added new intrinsic symbols.
(enum gfc_exec_op): Added EXEC_FAIL_IMAGE.
* gfortran.texi: Added description for the new API functions. Updated
coverage of gfortran of TS18508.
* intrinsic.c (add_functions): Added symbols to resolve new intrinsic
functions. 
* intrinsic.h: Added prototypes.
* iresolve.c (gfc_resolve_failed_images): Resolve the failed_images
intrinsic.
(gfc_resolve_image_status): Same for image_status.
(gfc_resolve_stopped_images): Same for stopped_images.
* libgfortran.h: Added prototypes.
* match.c (gfc_match_if): Added matching of FAIL IMAGE statement.
(gfc_match_fail_image): Match a FAIL IMAGE statement.
* match.h: Added prototype.
* parse.c (decode_statement): Added matching for FAIL IMAGE.
(next_statement): Same.
(gfc_ascii_statement): Same.
* resolve.c: Same.
* simplify.c (gfc_simplify_failed_or_stopped_images): For COARRAY=
single a constant result can be returne.d
(gfc_simplify_image_status): For COARRAY=single the result is constant.
* st.c (gfc_free_statement): Added FAIL_IMAGE handling.
* trans-decl.c (gfc_build_builtin_function_decls): Added decls of the
new intrinsics.
* trans-expr.c (gfc_conv_procedure_call): This is first time all
arguments of a function are optional, which is now handled here
correctly.
* trans-intrinsic.c (conv_intrinsic_image_status): Translate
image_status.
(gfc_conv_intrinsic_function): Add support for image_status.
(gfc_is_intrinsic_libcall): Add support for the remaining new
intrinsics.
* trans-stmt.c (gfc_trans_fail_image): Trans a fail image.
* trans-stmt.h: Add the prototype for the above.
* trans.c (trans_code): Dispatch for fail_image.
* trans.h: Add the trees for the new intrinsics.

libgfortran/ChangeLog:

2017-03-04  Andre Vehreschild  

* caf/libcaf.h: Added prototypes and stat codes for failed and stopped
images.
* caf/single.c (void _gfortran_caf_fail_image): Add the routine.
(int _gfortran_caf_image_status): Same.
(_gfortran_caf_failed_images): Same.
(_gfortran_caf_stopped_images): Same.


gcc/testsuite/ChangeLog:

2017-03-04  Andre Vehreschild  

* gfortran.dg/coarray/fail_image_1.f08: New test.
* gfortran.dg/coarray/fail_image_2.f08: New test.
* gfortran.dg/coarray/failed_images_1.f08: New test.
* gfortran.dg/coarray/failed_images_2.f08: New test.
* gfortran.dg/coarray/image_status_1.f08: New test.
* gfortran.dg/coarray/image_status_2.f08: New test.
* gfortran.dg/coarray/stopped_images_1.f08: New test.
* gfortran.dg/coarray/stopped_images_2.f08: New test.
* gfortran.dg/coarray_fail_st.f90: New test.
* gfortran.dg/coarray_failed_images_1.f08: New test.
* gfortran.dg/coarray_image_status_1.f08: New test.
* gfortran.dg/coarray_stopped_images_1.f08: New test.

diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c
index c22bfa9..45bc68e 100644
--- a/gcc/fortran/check.c
+++ b/gcc/fortran/check.c
@@ -295,6 +295,29 @@ nonnegative_check (const char *arg, gfc_expr *expr)
 }
 
 
+/* If expr is a constant, then check to ensure that it is greater than zero.  */
+
+static bool
+positive_check (int n, gfc_expr *expr)
+{
+  int i;
+
+  if (expr->expr_type == EXPR_CONSTANT)
+{
+  gfc_extract_int (expr, );
+  if (i <= 0)
+	{
+	  gfc_error ("%qs argument of %qs intrinsic at %L must be positive",
+		 gfc_current_intrinsic_arg[n]->name, gfc_current_intrinsic,
+		 >where);
+	  return false;
+	}
+}
+
+  return true;
+}
+
+
 /* If expr2 is constant, then check that the value is less than
(less than or equal to, if 'or_equal' is true)