This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/31293] Implicit character and array returning functions
- From: "pault at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 2 Apr 2007 15:38:36 -0000
- Subject: [Bug fortran/31293] Implicit character and array returning functions
- References: <bug-31293-13404@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from pault at gcc dot gnu dot org 2007-04-02 16:38 -------
This fixes the problem and regtests:
Index: gcc/fortran/parse.c
===================================================================
*** gcc/fortran/parse.c (révision 123426)
--- gcc/fortran/parse.c (copie de travail)
*************** static void
*** 2896,2901 ****
--- 2896,2902 ----
parse_progunit (gfc_statement st)
{
gfc_state_data *p;
+ gfc_symbol *proc = NULL;
int n;
st = parse_spec (st);
*************** parse_progunit (gfc_statement st)
*** 2913,2918 ****
--- 2914,2940 ----
default:
break;
+ }
+
+ proc = gfc_current_ns->proc_name;
+ if (gfc_current_state () == COMP_FUNCTION
+ && proc->attr.contained
+ && (proc->attr.implicit_type
+ || proc->result->ts.type == BT_UNKNOWN))
+ {
+ if (gfc_set_default_type (proc->result, 0, gfc_current_ns)
+ == SUCCESS)
+ {
+ if (proc->result != proc)
+ proc->ts = proc->result->ts;
+ }
+ else
+ {
+ gfc_error ("unable to implicitly type the function result "
+ "'%s' at %L", proc->result->name,
+ &proc->result->declared_at);
+ proc->result->attr.untyped = 1;
+ }
}
loop:
It has the same behaviour as LF95, in respect of interface1.f90 - ie. no errors
or warnings, in respect of explcit typing being needed for the function. This
is just a matter of getting the condition right.
--
pault at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |pault at gcc dot gnu dot org
|dot org |
Status|UNCONFIRMED |ASSIGNED
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2007-04-02 16:38:36
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31293