- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Minimal reproducible code snippet:
module vector3d_module
implicit none
type :: vector3d_type
real :: x = 0.0
real :: y = 0.0
real :: z = 0.0
end type vector3d_type
type(vector3d_type), parameter :: vector3d_zero = vector3d_type(0.0, 0.0, 0.0)
interface vector3d_type
module procedure vector3d_constructor
end interface
contains
function vector3d_constructor() result(res)
implicit none
type(vector3d_type) :: res
res = vector3d_zero
end function vector3d_constructor
end module vector3d_module
program main
use vector3d_module
implicit none
print *, vector3d_zero
end program main
Compiler version: ifort 2021.8.0 Build 20221119_000000
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I just tested this reproducer with the compiler that will be released in shortly. NO ICE!! Both ifort and ifx compile without errors.
I do get ICE with the current compiler, 2021.8.0, as reported.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
for the record The ICE is on the main program changing the interface name to "vector3d_type1" compiles OK.
Source1.f90
C:\Users\...\Console3\Source1.f90: internal error: Please visit 'http://www.intel.com/software/products/support' for assistance.
C:\Users\...\Console3\Source1.f90: catastrophic error: Internal Compiler Error: Ref module: ffe_param.c
Clearly an ICE is bug no argument.
As an aside:
1] why have parameter vector3d_zero at all when you have default initialisation to zero in the type definition?
2] why try to redefine the defualt constructor why not use a modified name for an alternative constructor?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for your response, andrew_4619!
The initial code snippet I provided was just a minimal example to demonstrate the issue. However, here's a more practical version of the code that still encounters the same error:
module vector3d_module
implicit none
type :: vector3d_type
real :: x = 0.0
real :: y = 0.0
real :: z = 0.0
end type vector3d_type
type :: vector2d_type
real :: x = 0.0
real :: y = 0.0
end type vector2d_type
type(vector3d_type), parameter :: vector3d_unitx = vector3d_type(1.0, 0.0, 0.0)
interface vector3d_type
module procedure vector3d_from_vector2d
end interface
contains
function vector3d_from_vector2d(vector2d) result(res)
implicit none
type(vector2d_type), intent(in) :: vector2d
type(vector3d_type) :: res
res%x = vector2d%x
res%y = vector2d%y
res%z = 0.0
end function vector3d_from_vector2d
end module vector3d_module
program main
use vector3d_module
implicit none
print *, vector3d_unitx
end program main
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In response to your question about using vector_zero while having default initialization to zero in the type definition, I believe that employing a predefined parameter, such as vector_zero, is a good practice. This approach ensures that we explicitly reference a clearly-defined constant, rather than relying on default initialization values. This can lead to more maintainable and understandable code, especially when working with larger or more complex projects.
@andrew_4619 wrote:
for the record The ICE is on the main program changing the interface name to "vector3d_type1" compiles OK.
Source1.f90
C:\Users\...\Console3\Source1.f90: internal error: Please visit 'http://www.intel.com/software/products/support' for assistance.
C:\Users\...\Console3\Source1.f90: catastrophic error: Internal Compiler Error: Ref module: ffe_param.c
Clearly an ICE is bug no argument.
As an aside:
1] why have parameter vector3d_zero at all when you have default initialisation to zero in the type definition?
2] why try to redefine the defualt constructor why not use a modified name for an alternative constructor?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Interestingly this compiles OK if you use 'last years' compiler rather than the latest so the ICE is a regression.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I just tested this reproducer with the compiler that will be released in shortly. NO ICE!! Both ifort and ifx compile without errors.
I do get ICE with the current compiler, 2021.8.0, as reported.

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