gfc_code *c;
gfc_symbol *proc;
gfc_entry_list *el;
- char name[GFC_MAX_SYMBOL_LEN + 1];
+ /* Provide sufficient space to hold "master.%d.%s". */
+ char name[GFC_MAX_SYMBOL_LEN + 1 + 18];
static int master_count = 0;
if (ns->proc_name == NULL)
"entries returning variables of different "
"string lengths", ns->entries->sym->name,
&ns->entries->sym->declared_at);
+ else if (el->sym->result->attr.allocatable
+ != ns->entries->sym->result->attr.allocatable)
+ break;
}
if (el == NULL)
gfc_set_array_spec (proc, gfc_copy_array_spec (sym->as), NULL);
if (sym->attr.pointer)
gfc_add_pointer (&proc->attr, NULL);
+ if (sym->attr.allocatable)
+ gfc_add_allocatable (&proc->attr, NULL);
}
else
{
"FUNCTION %s at %L", sym->name,
ns->entries->sym->name, &sym->declared_at);
}
+ else if (sym->attr.allocatable)
+ {
+ if (el == ns->entries)
+ gfc_error ("FUNCTION result %s cannot be ALLOCATABLE in "
+ "FUNCTION %s at %L", sym->name,
+ ns->entries->sym->name, &sym->declared_at);
+ else
+ gfc_error ("ENTRY result %s cannot be ALLOCATABLE in "
+ "FUNCTION %s at %L", sym->name,
+ ns->entries->sym->name, &sym->declared_at);
+ }
else
{
ts = &sym->ts;
*/
if (flag_f2c && sym->ts.type == BT_REAL
&& sym->ts.kind == gfc_default_real_kind
+ && !sym->attr.pointer
+ && !sym->attr.allocatable
&& !sym->attr.always_explicit)
se->expr = fold_convert (gfc_get_real_type (sym->ts.kind), se->expr);
require an explicit interface, as no compatibility problems can
arise there. */
if (flag_f2c && sym->ts.type == BT_COMPLEX
+ && !sym->attr.pointer
+ && !sym->attr.allocatable
&& !sym->attr.intrinsic && !sym->attr.always_explicit)
return 1;
type = gfc_get_mixed_entry_union (sym->ns);
else if (flag_f2c && sym->ts.type == BT_REAL
&& sym->ts.kind == gfc_default_real_kind
+ && !sym->attr.pointer
+ && !sym->attr.allocatable
&& !sym->attr.always_explicit)
{
/* Special case: f2c calling conventions require that (scalar)
--- /dev/null
+! { dg-do run }
+! { dg-additional-options "-fno-f2c" }
+!
+! PR fortran/104312 - ICE in fold_convert_loc with entry, -ff2c: control
+! Contributed by G.Steinmetz
+
+module m
+ implicit none
+contains
+ function f()
+ real, pointer :: f, e
+ real, target :: a(2) = [1,2]
+ f => a(1)
+ return
+ entry e()
+ e => a(2)
+ end
+ function g()
+ complex, pointer :: g,h
+ complex, target :: a(2) = [3,4]
+ g => a(1)
+ return
+ entry h()
+ h => a(2)
+ end
+ function f3()
+ real, allocatable :: f3, e3
+ allocate (f3, source=1.0)
+ return
+ entry e3()
+ allocate (e3, source=2.0)
+ end
+ function g3()
+ complex, allocatable :: g3, h3
+ allocate (g3, source=(3.0,0.0))
+ return
+ entry h3()
+ allocate (h3, source=(4.0,0.0))
+ end
+end
+
+program p
+ use m
+ real, pointer :: x
+ complex, pointer :: c
+ real :: y
+ complex :: d
+ x => f()
+ if (x /= 1.0) stop 1
+ x => e()
+ if (x /= 2.0) stop 2
+ c => g()
+ if (c /= (3.0,0.0)) stop 3
+ c => h()
+ if (c /= (4.0,0.0)) stop 4
+ y = f3()
+ if (y /= 1.0) stop 5
+ y = e3()
+ if (y /= 2.0) stop 6
+ d = g3()
+ if (d /= (3.0,0.0)) stop 7
+ d = h3()
+ if (d /= (4.0,0.0)) stop 8
+end
--- /dev/null
+! { dg-do run }
+! { dg-additional-options "-ff2c" }
+!
+! PR fortran/104312 - ICE in fold_convert_loc with entry, -ff2c: test
+! Contributed by G.Steinmetz
+
+module m
+ implicit none
+contains
+ function f()
+ real, pointer :: f, e
+ real, target :: a(2) = [1,2]
+ f => a(1)
+ return
+ entry e()
+ e => a(2)
+ end
+ function g()
+ complex, pointer :: g,h
+ complex, target :: a(2) = [3,4]
+ g => a(1)
+ return
+ entry h()
+ h => a(2)
+ end
+ function f3()
+ real, allocatable :: f3, e3
+ allocate (f3, source=1.0)
+ return
+ entry e3()
+ allocate (e3, source=2.0)
+ end
+ function g3()
+ complex, allocatable :: g3, h3
+ allocate (g3, source=(3.0,0.0))
+ return
+ entry h3()
+ allocate (h3, source=(4.0,0.0))
+ end
+end
+
+program p
+ use m
+ real, pointer :: x
+ complex, pointer :: c
+ real :: y
+ complex :: d
+ x => f()
+ if (x /= 1.0) stop 1
+ x => e()
+ if (x /= 2.0) stop 2
+ c => g()
+ if (c /= (3.0,0.0)) stop 3
+ c => h()
+ if (c /= (4.0,0.0)) stop 4
+ y = f3()
+ if (y /= 1.0) stop 5
+ y = e3()
+ if (y /= 2.0) stop 6
+ d = g3()
+ if (d /= (3.0,0.0)) stop 7
+ d = h3()
+ if (d /= (4.0,0.0)) stop 8
+end