Ping: Possible patch for fortran/67524
Louis Krupp
louis.krupp@zoho.com
Mon Oct 3 18:13:00 GMT 2016
When a function has an additional ENTRY point of a different type than the main function, a "mixed-entry master" function is created. This function should not have default implicit type rules applied. When the default type is CHARACTER, things become especially dire.
Louis Krupp
-------------- next part --------------
Index: gcc/fortran/ChangeLog
===================================================================
--- gcc/fortran/ChangeLog (revision 240300)
+++ gcc/fortran/ChangeLog (working copy)
@@ -1,3 +1,9 @@
+2016-09-21 Louis Krupp <louis.krupp@zoho.com>
+
+ PR fortran/67524
+ * resolve.c (resolve_symbol): Don't apply default type rules to
+ mixed-entry master created for function entry points.
+
2016-09-20 Marek Polacek <polacek@redhat.com>
* trans-intrinsic.c (conv_expr_ref_to_caf_ref): Adjust fall through
Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c (revision 240300)
+++ gcc/fortran/resolve.c (working copy)
@@ -13884,7 +13884,10 @@ resolve_symbol (gfc_symbol *sym)
/* The specific case of an external procedure should emit an error
in the case that there is no implicit type. */
if (!mp_flag)
- gfc_set_default_type (sym, sym->attr.external, NULL);
+ {
+ if (!sym->attr.mixed_entry_master)
+ gfc_set_default_type (sym, sym->attr.external, NULL);
+ }
else
{
/* Result may be in another namespace. */
Index: gcc/testsuite/ChangeLog
===================================================================
--- gcc/testsuite/ChangeLog (revision 240300)
+++ gcc/testsuite/ChangeLog (working copy)
@@ -1,3 +1,8 @@
+2016-09-21 Louis Krupp <louis.krupp@zoho.com>
+
+ PR fortran/67524
+ * gfortran.dg/pr67524.f90: New test.
+
2016-09-21 Senthil Kumar Selvaraj <senthil_kumar.selvaraj@atmel.com>
* gcc.dg/tree-ssa/pr64130.c: Use __UINT32_TYPE__ instead of int.
Index: gcc/testsuite/gfortran.dg/pr67524.f90
===================================================================
--- gcc/testsuite/gfortran.dg/pr67524.f90 (nonexistent)
+++ gcc/testsuite/gfortran.dg/pr67524.f90 (working copy)
@@ -0,0 +1,20 @@
+! { dg-do run }
+module m
+ implicit character(8) (a-z)
+contains
+ function f(x)
+ integer :: x
+ integer :: f
+ real :: e
+ f = x
+ return
+ entry e(x)
+ e = x
+ end
+end module
+
+program p
+ use m
+ if (f(1) /= 1) call abort
+ if (e(1) /= 1.0) call abort
+end
More information about the Fortran
mailing list