- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ifx (IFX) 2024.0.0 20231017 has what I believe to be a compiler bug that doesn't allow function pointer references, but not invocations, to non pure functions in a pure procedure. I believe this should be allowed based on 15.5.1 of the Fortran 2023 Standard:
R5120 function-reference is procedure-designator ( [ actual-arg-spec-list ] )
A procedure-designator is only a function-reference if it is followed by parentheses. As such, by my and my colleagues' reading of the standard, the procedure-designators (L22 in the following code sample) in a pure procedure should be allowed, but currently they cause a compile-time error.
Reproducer:
module test_m
implicit none
abstract interface
logical function test_func_i()
implicit none
end function
end interface
type test_t
procedure(test_func_i), pointer, nopass :: test_func_ => null()
contains
procedure :: eq
generic :: operator(==) => eq
end type
contains
pure function eq(lhs,rhs) result(lhs_eq_rhs)
class(test_t), intent(in) :: lhs, rhs
logical lhs_eq_rhs
lhs_eq_rhs = associated(lhs%test_func_,rhs%test_func_)
end function
end module
Compile error caused by above:
~/test$ ifx -c test_m.f90
test_m.f90(22): error #7137: Any procedure referenced in a PURE procedure, including one referenced via a defined operation or assignment, must have an explicit interface and be declared PURE. [TEST_FUNC_]
lhs_eq_rhs = associated(lhs%test_func_,rhs%test_func_)
--------------------------------^
test_m.f90(22): error #7137: Any procedure referenced in a PURE procedure, including one referenced via a defined operation or assignment, must have an explicit interface and be declared PURE. [TEST_FUNC_]
lhs_eq_rhs = associated(lhs%test_func_,rhs%test_func_)
-----------------------------------------------^
test_m.f90(22): error #6106: Not a valid argument for ASSOCIATE or SELECT TYPE. [ASSOCIATED]
lhs_eq_rhs = associated(lhs%test_func_,rhs%test_func_)
----------------------------^
test_m.f90(22): internal error: Please visit 'http://www.intel.com/software/products/support' for assistance.
lhs_eq_rhs = associated(lhs%test_func_,rhs%test_func_)
^
test_m.f90(22): catastrophic error: Internal Compiler Error: Ref module: ffe_axpnd.c
compilation aborted for test_m.f90 (code 1)
Thanks.
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for bringing this to our attention. I have escalated the issue to our Compiler Engineering team for a fix.
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