- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I found the following issues with ifx regarding this F2018 intrinsic:
program p
use iso_fortran_env, only: int32, real32
implicit none
integer(int32) :: i4
real(real32) :: r4 = 1.e9
logical :: t = .true., f = .false.
print *, OUT_OF_RANGE (r4, i4, round=f)
print *, OUT_OF_RANGE (r4, i4, round=t)
print *, OUT_OF_RANGE (r4, i4) ! ROUND is optional here!
! Check passing of optional argument
print *, my_out_of_range (r4, round=f)
print *, my_out_of_range (r4, round=t)
print *, my_out_of_range (r4) ! This crashes
contains
elemental logical function my_out_of_range (x, round)
real(real32), intent(in) :: x
logical, intent(in), optional :: round
my_out_of_range = out_of_range (x, 0_int32, round)
end function my_out_of_range
end
This runs correctly until line 15, where the missing optional argument is mishandled when transferring the optional dummy to the optional argument of the intrinsic. Since for other Fortran intrinsics optional arguments are properly dealt with by the compiler, it fails here for no good reason.
% ifx ifx-out_of_range.f90 -g -traceback && ./a.out
ifx: remark #10440: Note that use of a debug option without any optimization-level option will turnoff most compiler optimizations similar to use of '-O0'
F
F
F
F
F
forrtl: severe (174): SIGSEGV, segmentation fault occurred
Image PC Routine Line Source
libc.so.6 00007FF408257980 Unknown Unknown Unknown
a.out 0000000000405898 my_out_of_range 19 ifx-out_of_range.f90
a.out 0000000000405818 p 15 ifx-out_of_range.f90
a.out 00000000004055AD Unknown Unknown Unknown
libc.so.6 00007FF408240EEC Unknown Unknown Unknown
libc.so.6 00007FF408240FB5 __libc_start_main Unknown Unknown
a.out 00000000004054B1 Unknown Unknown Unknown
Furthermore, the following example is rejected:
program p
logical, parameter :: l0 = OUT_OF_RANGE (1.e9, 0)
end
I get:
% ifx ifx-out_of_range2.f90
ifx-out_of_range2.f90(2): error #6263: This intrinsic function is invalid in constant expressions. [OUT_OF_RANGE]
logical, parameter :: l0 = OUT_OF_RANGE (1.e9, 0)
-----------------------------^
compilation aborted for ifx-out_of_range2.f90 (code 1)
NAG compiles this one just fine, and I cannot find anything in the F2023 standard that confirms what ifx claims.
Thanks,
Harald
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is the ongoing issue of Intel Fortran not allowing "specification inquiry" functions (F2018 10.1.11p3, 10.1.12p1(4)) in constant expressions. It's been 2-3 years at least since I first brought this up to the team.

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