<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Issues with OUT_OF_RANGE in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Issues-with-OUT-OF-RANGE/m-p/1656124#M174830</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I found the following issues with ifx regarding this F2018 intrinsic:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="fortran"&gt;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&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;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.&amp;nbsp; Since for other Fortran intrinsics optional arguments are properly dealt with by the compiler, it fails here for no good reason.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="none"&gt;% ifx ifx-out_of_range.f90 -g -traceback &amp;amp;&amp;amp; ./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&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Furthermore, the following example is rejected:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="fortran"&gt;program p
  logical, parameter :: l0 = OUT_OF_RANGE (1.e9, 0)
end&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;I get:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="none"&gt;% 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)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;NAG compiles this one just fine, and I cannot find anything in the F2023 standard that confirms what ifx claims.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Harald&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 11 Jan 2025 16:38:40 GMT</pubDate>
    <dc:creator>Harald1</dc:creator>
    <dc:date>2025-01-11T16:38:40Z</dc:date>
    <item>
      <title>Issues with OUT_OF_RANGE</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Issues-with-OUT-OF-RANGE/m-p/1656124#M174830</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I found the following issues with ifx regarding this F2018 intrinsic:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="fortran"&gt;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&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;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.&amp;nbsp; Since for other Fortran intrinsics optional arguments are properly dealt with by the compiler, it fails here for no good reason.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="none"&gt;% ifx ifx-out_of_range.f90 -g -traceback &amp;amp;&amp;amp; ./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&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Furthermore, the following example is rejected:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="fortran"&gt;program p
  logical, parameter :: l0 = OUT_OF_RANGE (1.e9, 0)
end&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;I get:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="none"&gt;% 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)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;NAG compiles this one just fine, and I cannot find anything in the F2023 standard that confirms what ifx claims.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Harald&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 11 Jan 2025 16:38:40 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Issues-with-OUT-OF-RANGE/m-p/1656124#M174830</guid>
      <dc:creator>Harald1</dc:creator>
      <dc:date>2025-01-11T16:38:40Z</dc:date>
    </item>
    <item>
      <title>Re: Issues with OUT_OF_RANGE</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Issues-with-OUT-OF-RANGE/m-p/1656190#M174831</link>
      <description>&lt;P&gt;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.&lt;/P&gt;</description>
      <pubDate>Sat, 11 Jan 2025 21:50:16 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Issues-with-OUT-OF-RANGE/m-p/1656190#M174831</guid>
      <dc:creator>Steve_Lionel</dc:creator>
      <dc:date>2025-01-11T21:50:16Z</dc:date>
    </item>
  </channel>
</rss>

