- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Consider the following module (subprogram part left out) and program:
[fortran]module testmodule
implicit none
type, public, abstract :: expr
contains
procedure, non_overridable :: eval
procedure, non_overridable :: diff
end type
type, public, extends(expr) :: polynomial
real, dimension(:), allocatable :: c
end type polynomial
type, public, extends(polynomial) :: posynomial
real, dimension(:), allocatable :: p
end type posynomial
contains
[...]
end module testmodule[/fortran]
[fortran]program main
implicit none
use testmodule
type(polynomial) :: poly type(posynomial) :: posy poly = polynomial([1., 2., 3.]) ! OK posy = posynomial([1., 2., 3.], [0., 1., 2.5]) ! throws compiler error #8212 end program main[/fortran] Compiling the above code with ifort 12.1.3.293 (build 20120212) gives me the error:
[bash]error #8212: Omitted field is not initialized. Field initialization missing:
use testmodule
type(polynomial) :: poly type(posynomial) :: posy poly = polynomial([1., 2., 3.]) ! OK posy = posynomial([1., 2., 3.], [0., 1., 2.5]) ! throws compiler error #8212 end program main[/fortran] Compiling the above code with ifort 12.1.3.293 (build 20120212) gives me the error:
[bash]error #8212: Omitted field is not initialized. Field initialization missing:
posy = posynomial([1., 2., 3.], [0., 1., 2.5])
^[/bash] even though the additional field [0., 1., 2.5] is evidently present. The above code compiles and runs without issues when I compile it with gfortran. A compiler bug?
Edit: Interestingly, it does compile properly when I invoke the constructor with posy = posynomial([1., 2., 3.], p = [0., 1., 2.5]) or posy = posynomial(c = [1., 2., 3.], p = [0., 1., 2.5]).
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, it's a compiler bug. It also goes away if type expr has components. I will report this to the developers - thanks for bringing it to our attention. Issue ID is DPD200180239.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This has been fixed for a release later this year.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page