[Patch, Fortran, OOP] PR 59450: ICE for type-bound-procedure expression in module procedure interface
Janus Weil
janus@gcc.gnu.org
Wed Dec 11 21:58:00 GMT 2013
Hi all,
the PR in the subject line involves a module procedure whose result
has array bounds which contain a type-bound procedure call. Since the
procedure interface is written to the .mod file, also the TBP
expression needs to be written. This leads to an ICE, since it simply
has not been implemented yet.
When writing a function reference, we now discriminate between three
cases: (1) 'ordinary' procedures, (2) type-bound procedures and (3)
intrinsic procedures. We first read/write an integer value to indicate
which case we're dealing with, and then do the specific I/O for this
case (see patch). Up to now we basically did the same already, but
only including two cases (ordinary and intrinsic functions).
The patch has been regtested on x86_64-unknown-linux-gnu. Ok for trunk?
Should I also bump the MOD_VERSION?
Cheers,
Janus
2013-12-11 Janus Weil <janus@gcc.gnu.org>
PR fortran/59450
* module.c (mio_expr): Handle type-bound function expressions.
2013-12-11 Janus Weil <janus@gcc.gnu.org>
PR fortran/59450
* gfortran.dg/typebound_proc_31.f90: New.
-------------- next part --------------
Index: gcc/fortran/module.c
===================================================================
--- gcc/fortran/module.c (revision 205857)
+++ gcc/fortran/module.c (working copy)
@@ -3358,12 +3358,24 @@ mio_expr (gfc_expr **ep)
{
e->value.function.name
= mio_allocated_string (e->value.function.name);
- flag = e->value.function.esym != NULL;
+ if (e->value.function.esym)
+ flag = 1;
+ else if (e->ref)
+ flag = 2;
+ else
+ flag = 0;
mio_integer (&flag);
- if (flag)
- mio_symbol_ref (&e->value.function.esym);
- else
- write_atom (ATOM_STRING, e->value.function.isym->name);
+ switch (flag)
+ {
+ case 1:
+ mio_symbol_ref (&e->value.function.esym);
+ break;
+ case 2:
+ mio_ref_list (&e->ref);
+ break;
+ default:
+ write_atom (ATOM_STRING, e->value.function.isym->name);
+ }
}
else
{
@@ -3372,10 +3384,15 @@ mio_expr (gfc_expr **ep)
free (atom_string);
mio_integer (&flag);
- if (flag)
- mio_symbol_ref (&e->value.function.esym);
- else
+ switch (flag)
{
+ case 1:
+ mio_symbol_ref (&e->value.function.esym);
+ break;
+ case 2:
+ mio_ref_list (&e->ref);
+ break;
+ default:
require_atom (ATOM_STRING);
e->value.function.isym = gfc_find_function (atom_string);
free (atom_string);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: typebound_proc_31.f90
Type: text/x-fortran
Size: 532 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20131211/c6cdeebe/attachment.bin>
More information about the Fortran
mailing list