This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/78443] New: Incorrect behavior with non_overridable keyword
- From: "perini at wisc dot edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 21 Nov 2016 08:15:50 +0000
- Subject: [Bug fortran/78443] New: Incorrect behavior with non_overridable keyword
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78443
Bug ID: 78443
Summary: Incorrect behavior with non_overridable keyword
Product: gcc
Version: 6.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: perini at wisc dot edu
Target Milestone: ---
Created attachment 40094
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40094&action=edit
Minimal program to test the non_overridable keyword issue
Hi,
I've been having some issues recently when using the non_overridable keyword on
an extended derived type, with gfortran 5.3.0 and 6.1.0.
In essence, when the non_overridable function is called from:
- A type which extends an abstract type -> segmentation fault (looks like call
to null function pointer);
- A type which extends a non-abstract type -> call the parent's function
instead than the own function.
"Modern Fortran" by Metcalf Reid Cohen states:
- If the non_overridable attribute appears, that type-bound procedure cannot be
overridden during type extension;
- non_overridable is incompatible with deferred, since that requires the
type-bound procedure to be overridden;
- Overriding a type-bound procedure is not permitted if the inherited one has
the non_overridable attribute
So I'm guessing that using the non_overridable keyword in a non-abstract
extended type should be OK and prevent the function being overridden in further
type extensions. A bit more discussion has taken place in
http://stackoverflow.com/questions/40510423/segmentation-fault-with-deferred-functions-and-non-overridable-keyword
The attached code reproduces the error.
Thanks for the great work on gfortran!
Federico