From 15c5428664451f2d203d33e7af1af9ed4f535202 Mon Sep 17 00:00:00 2001
From: Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
Date: Sun, 6 Sep 2020 18:24:50 +0200
Subject: [PATCH] fortran: caf_fail_image expects no argument

gcc/fortran/ChangeLog

	PR fortran/96947
	* trans-stmt.c (gfc_trans_fail_image): caf_fail_image
	expects no argument.

gcc/testsuite/ChangeLog

	* gfortran.dg/coarray_fail_st.f90: Adjust test.

(cherry picked from commit 3489d80fee42764460cb06f7a2e9f126c18602b4)
Signed-off-by: Kirill A. Korinsky <kirill@korins.ky>
---
 gcc/fortran/trans-stmt.c                      | 3 +--
 gcc/testsuite/gfortran.dg/coarray_fail_st.f90 | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git gcc/fortran/trans-stmt.c gcc/fortran/trans-stmt.c
index cecb7430bd5..d3ab11c0516 100644
--- gcc/fortran/trans-stmt.c
+++ gcc/fortran/trans-stmt.c
@@ -689,8 +689,7 @@ gfc_trans_fail_image (gfc_code *code ATTRIBUTE_UNUSED)
 {
   if (flag_coarray == GFC_FCOARRAY_LIB)
     return build_call_expr_loc (input_location,
-				gfor_fndecl_caf_fail_image, 1,
-				build_int_cst (pchar_type_node, 0));
+				gfor_fndecl_caf_fail_image, 0);
   else
     {
       const char *name = gfc_get_string (PREFIX ("exit_i%d"), 4);
diff --git gcc/testsuite/gfortran.dg/coarray_fail_st.f90 gcc/testsuite/gfortran.dg/coarray_fail_st.f90
index d4eb8e2c240..8c86f55690b 100644
--- gcc/testsuite/gfortran.dg/coarray_fail_st.f90
+++ gcc/testsuite/gfortran.dg/coarray_fail_st.f90
@@ -18,4 +18,4 @@ program fail_statement
 
 end program fail_statement
 
-! { dg-final { scan-tree-dump-times "_gfortran_caf_fail_image \\\(0B\\\);" 1 "original" } }
+! { dg-final { scan-tree-dump-times "_gfortran_caf_fail_image \\\(\\\);" 1 "original" } }
-- 
2.42.1

