[PATCH, committed] Fortran: do not generate conflicting results under -ff2c [PR104313]

2022-07-15 Thread Harald Anlauf via Fortran
Dear all,

the attached patch by Steve fixes a regression under -ff2c for functions
where the result is not set.  There would otherwise be conflicting
declarations of the returned result, which gimple doesn't like.

I've committed this as obvious after discussion with Steve for him,
see PR, as

commit r13-1715-g517fb1a78102df43f052c6934c27dd51d786aff7

This fixes a 10/11/12/13 regression, will be backported in the next days.

Thanks,
Harald

From 517fb1a78102df43f052c6934c27dd51d786aff7 Mon Sep 17 00:00:00 2001
From: Steve Kargl 
Date: Fri, 15 Jul 2022 22:07:15 +0200
Subject: [PATCH] Fortran: do not generate conflicting results under -ff2c
 [PR104313]

gcc/fortran/ChangeLog:

	PR fortran/104313
	* trans-decl.cc (gfc_generate_return): Do not generate conflicting
	fake results for functions with no result variable under -ff2c.

gcc/testsuite/ChangeLog:

	PR fortran/104313
	* gfortran.dg/pr104313.f: New test.
---
 gcc/fortran/trans-decl.cc|  2 +-
 gcc/testsuite/gfortran.dg/pr104313.f | 11 +++
 2 files changed, 12 insertions(+), 1 deletion(-)
 create mode 100644 gcc/testsuite/gfortran.dg/pr104313.f

diff --git a/gcc/fortran/trans-decl.cc b/gcc/fortran/trans-decl.cc
index 6493cc2f6b1..908a4c6d42e 100644
--- a/gcc/fortran/trans-decl.cc
+++ b/gcc/fortran/trans-decl.cc
@@ -6474,7 +6474,7 @@ gfc_generate_return (void)
 	 NULL_TREE, and a 'return' is generated without a variable.
 	 The following generates a 'return __result_XXX' where XXX is
 	 the function name.  */
-	  if (sym == sym->result && sym->attr.function)
+	  if (sym == sym->result && sym->attr.function && !flag_f2c)
 	{
 	  result = gfc_get_fake_result_decl (sym, 0);
 	  result = fold_build2_loc (input_location, MODIFY_EXPR,
diff --git a/gcc/testsuite/gfortran.dg/pr104313.f b/gcc/testsuite/gfortran.dg/pr104313.f
new file mode 100644
index 000..89c8947cb0a
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr104313.f
@@ -0,0 +1,11 @@
+! { dg-do compile }
+! { dg-additional-options "-ff2c -fdump-tree-original" }
+!
+! PR fortran/104313 - ICE verify_gimple failed with -ff2c
+! Contributed by G.Steinmetz
+
+  function f(a)
+  return
+  end
+
+! { dg-final { scan-tree-dump-times "return" 1 "original" } }
--
2.35.3



Inquiry: Country of Origin for gfortran

2022-07-15 Thread Zhang, Cynthia X. (GSFC-710.0)[TELOPHASE CORP] via Fortran
Hello, my name is Cynthia and I am a Supply Chain Risk Management Analyst at 
NASA. NASA is currently conducting a supply chain assessment of gfortran. As 
stated in Sections 208 and 514 of the Consolidated Appropriations Act, 2022, 
Public Law 117-103, enacted March 15, 2022, a required step of our process is 
to verify the Country of Origin (CoO) information for the product (i.e., the 
country where the products were developed, manufactured, and assembled.)
As gfortran is open source, we understand that this inquiry is not directly 
applicable, as contributions may be made from individuals from around the 
world. In this case, NASA is interested in confirming the following information:

  1.  Is there an organization which sponsors/publishes the project, or a 
primary developer who audits the code for potential vulnerabilities, errors, or 
malicious code? Y/N
  2.  Does gfortran have an overseeing organization or individual along these 
lines? Y/N

  1.  If so, please provide the name of the organization and country they are 
established in.
If the information above is unknown or cannot be provided, we request that you 
provide the country or list of countries where the majority of contributions 
originate from to satisfy Sections 208 and 514 of the Consolidated 
Appropriations Act, 2022, Public Law 117-103, enacted March 15, 2022.

Thank you,
Cynthia