diff options
author | domob <domob@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-03-29 17:47:00 +0000 |
---|---|---|
committer | domob <domob@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-03-29 17:47:00 +0000 |
commit | 61c3b81de7853e605c3bc11f373086cd4c161121 (patch) | |
tree | 35f65c6aad1726518da105f2c369fcb510dd32a0 /gcc/fortran/module.c | |
parent | 68e09621f09746e2e15e58cb102b537543eda6cd (diff) | |
download | gcc-61c3b81de7853e605c3bc11f373086cd4c161121.tar.gz |
2009-03-29 Daniel Kraft <d@domob.eu>
PR fortran/37423
* gfortran.h (struct gfc_typebound_proc): Added new flag `deferred' and
added a comment explaining DEFERRED binding handling.
* decl.c (match_binding_attributes): Really match DEFERRED attribute.
(match_procedure_in_type): Really match PROCEDURE(interface) syntax
and do some validity checks for DEFERRED and this construct.
* module.c (binding_overriding): New string constant for DEFERRED.
(mio_typebound_proc): Module-IO DEFERRED flag.
* resolve.c (check_typebound_override): Ensure that a non-DEFERRED
binding is not overridden by a DEFERRED one.
(resolve_typebound_procedure): Allow abstract interfaces as targets
for DEFERRED bindings.
(ensure_not_abstract_walker), (ensure_not_abstract): New methods.
(resolve_fl_derived): Use new `ensure_not_abstract' method for
non-ABSTRACT types extending ABSTRACT ones to ensure each DEFERRED
binding is overridden.
(check_typebound_baseobject): New method.
(resolve_compcall), (resolve_typebound_call): Check base-object of
the type-bound procedure call.
* gfc-internals.texi (Type-bound procedures): Document a little bit
about internal handling of DEFERRED bindings.
2009-03-29 Daniel Kraft <d@domob.eu>
PR fortran/37423
* gfortran.dg/typebound_proc_4.f03: Remove not-implemented check for
DEFERRED bindings.
* gfortran.dg/typebound_proc_9.f03: New test.
* gfortran.dg/typebound_proc_10.f03: New test.
* gfortran.dg/typebound_proc_11.f03: New test.
* gfortran.dg/abstract_type_5.f03: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@145248 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/module.c')
-rw-r--r-- | gcc/fortran/module.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c index d5a9f54a76a..b5b79d03992 100644 --- a/gcc/fortran/module.c +++ b/gcc/fortran/module.c @@ -1700,6 +1700,7 @@ static const mstring binding_overriding[] = { minit ("OVERRIDABLE", 0), minit ("NON_OVERRIDABLE", 1), + minit ("DEFERRED", 2), minit (NULL, -1) }; static const mstring binding_generic[] = @@ -3205,6 +3206,7 @@ static void mio_typebound_proc (gfc_typebound_proc** proc) { int flag; + int overriding_flag; if (iomode == IO_INPUT) { @@ -3217,9 +3219,15 @@ mio_typebound_proc (gfc_typebound_proc** proc) (*proc)->access = MIO_NAME (gfc_access) ((*proc)->access, access_types); + /* IO the NON_OVERRIDABLE/DEFERRED combination. */ + gcc_assert (!((*proc)->deferred && (*proc)->non_overridable)); + overriding_flag = ((*proc)->deferred << 1) | (*proc)->non_overridable; + overriding_flag = mio_name (overriding_flag, binding_overriding); + (*proc)->deferred = ((overriding_flag & 2) != 0); + (*proc)->non_overridable = ((overriding_flag & 1) != 0); + gcc_assert (!((*proc)->deferred && (*proc)->non_overridable)); + (*proc)->nopass = mio_name ((*proc)->nopass, binding_passing); - (*proc)->non_overridable = mio_name ((*proc)->non_overridable, - binding_overriding); (*proc)->is_generic = mio_name ((*proc)->is_generic, binding_generic); if (iomode == IO_INPUT) |