public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch] Fortran: _gfortran_caf_fail_image() should have no argument
@ 2020-09-06 16:03 FX
  2020-09-06 16:12 ` Thomas Koenig
  0 siblings, 1 reply; 3+ messages in thread
From: FX @ 2020-09-06 16:03 UTC (permalink / raw)
  To: gcc-patches; +Cc: fortran, vehre

[-- Attachment #1: Type: text/plain, Size: 771 bytes --]

Hi,

The Fortran front-end, in gfc_trans_fail_image() emits a call to _gfortran_caf_fail_image with one argument (a NULL pointer):

    return build_call_expr_loc (input_location,
                                gfor_fndecl_caf_fail_image, 1,
                                build_int_cst (pchar_type_node, 0));

while the prototype for the function in libgfortran is clear that it takes no argument:

  void _gfortran_caf_fail_image (void) __attribute__ ((noreturn));

The bug was filed as https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96947
This obvious patch removes the useless argument (which triggers wrong code generation on aarch64-apple-darwin20).


Regtested on x86_64-apple-darwin19 and tested on aarch64-apple-darwin20.
OK to commit?

FX


[-- Attachment #2: fail_image.diff --]
[-- Type: application/octet-stream, Size: 1036 bytes --]

diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c
index 54b56c4f01d..1f183b9dcd0 100644
--- a/gcc/fortran/trans-stmt.c
+++ b/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 a/gcc/testsuite/gfortran.dg/coarray_fail_st.f90 b/gcc/testsuite/gfortran.dg/coarray_fail_st.f90
index d4eb8e2c240..8c86f55690b 100644
--- a/gcc/testsuite/gfortran.dg/coarray_fail_st.f90
+++ b/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" } }

[-- Attachment #3: fail_image.ChangeLog --]
[-- Type: application/octet-stream, Size: 251 bytes --]

2020-09-06  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>

	* trans-stmt.c (gfc_trans_fail_image): caf_fail_image
	expects no argument.

2020-09-06  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch] Fortran: _gfortran_caf_fail_image() should have no argument
  2020-09-06 16:03 [patch] Fortran: _gfortran_caf_fail_image() should have no argument FX
@ 2020-09-06 16:12 ` Thomas Koenig
  2020-09-06 16:30   ` FX
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Koenig @ 2020-09-06 16:12 UTC (permalink / raw)
  To: FX, gcc-patches; +Cc: fortran

Hi FX,

> OK to commit?

OK!

Best regards

	Thomas

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch] Fortran: _gfortran_caf_fail_image() should have no argument
  2020-09-06 16:12 ` Thomas Koenig
@ 2020-09-06 16:30   ` FX
  0 siblings, 0 replies; 3+ messages in thread
From: FX @ 2020-09-06 16:30 UTC (permalink / raw)
  To: Thomas Koenig; +Cc: gcc-patches, fortran

> OK!

Committed at https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=3489d80fee42764460cb06f7a2e9f126c18602b4
It’s my first commit since GCC moved to git, let me know if I did it correctly :)

FX

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-09-06 16:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-06 16:03 [patch] Fortran: _gfortran_caf_fail_image() should have no argument FX
2020-09-06 16:12 ` Thomas Koenig
2020-09-06 16:30   ` FX

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).