Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29285 Discussions

Error using extended type constructor

sfranzen
Beginner
598 Views
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:

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]).

0 Kudos
2 Replies
Steven_L_Intel1
Employee
598 Views
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.
0 Kudos
Steven_L_Intel1
Employee
598 Views
This has been fixed for a release later this year.
0 Kudos
Reply