<?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 Re:Couldn't use a integer parameter in submodules in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Couldn-t-use-a-integer-parameter-in-submodules/m-p/1374181#M160885</link>
    <description>&lt;P&gt;I filed a bug report, CMPLRLLVM-36605, for you.&lt;/P&gt;&lt;P&gt;And, yes, you see the same messages with ifort and ifx since they share the same front-end. &lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;BR /&gt;</description>
    <pubDate>Mon, 04 Apr 2022 19:27:15 GMT</pubDate>
    <dc:creator>Barbara_P_Intel</dc:creator>
    <dc:date>2022-04-04T19:27:15Z</dc:date>
    <item>
      <title>Couldn't use a integer parameter in submodules</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Couldn-t-use-a-integer-parameter-in-submodules/m-p/1373668#M160860</link>
      <description>&lt;P&gt;Both ifort and ifx don't accept using a parameter integer declared within the module to be used in function declarations.&lt;/P&gt;
&lt;P&gt;This is the minimized reproducer:&lt;/P&gt;
&lt;LI-CODE lang="fortran"&gt;module aaa
  implicit none
  integer, parameter :: dp = selected_real_kind(15)
  interface
    real(dp) module function foo(x)
      real(dp) :: x
    end function foo
  end interface
end module aaa

submodule(aaa) bbb
  implicit none
contains
  real(dp) module function foo(x)
    real(dp) :: x
    foo = x
  end function foo
end submodule bbb&lt;/LI-CODE&gt;&lt;LI-CODE lang="none"&gt;$ ifx -c sub.f90
sub.f90(5): error #6683: A kind type parameter must be a compile-time constant.   [DP]
    real(dp) module function foo(x)
---------^
sub.f90(11): error #8765: Error in opening the compiled ancestor module file.   [AAA]
submodule(aaa) bbb
----------^
sub.f90(14): error #6683: A kind type parameter must be a compile-time constant.   [DP]
  real(dp) module function foo(x)
-------^
sub.f90(14): error #6115: A separate interface body must have been declared in the program unit or an ancestor of the program unit for the separate module procedure.   [FOO]
  real(dp) module function foo(x)
---------------------------^
sub.f90(15): error #6683: A kind type parameter must be a compile-time constant.   [DP]
    real(dp) :: x
---------^
compilation aborted for sub.f90 (code 1)&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;$ ifort -c sub.f90
sub.f90(5): error #6683: A kind type parameter must be a compile-time constant.   [DP]
    real(dp) module function foo(x)
---------^
sub.f90(11): error #8765: Error in opening the compiled ancestor module file.   [AAA]
submodule(aaa) bbb
----------^
sub.f90(14): error #6683: A kind type parameter must be a compile-time constant.   [DP]
  real(dp) module function foo(x)
-------^
sub.f90(14): error #6115: A separate interface body must have been declared in the program unit or an ancestor of the program unit for the separate module procedure.   [FOO]
  real(dp) module function foo(x)
---------------------------^
sub.f90(15): error #6683: A kind type parameter must be a compile-time constant.   [DP]
    real(dp) :: x
---------^
compilation aborted for sub.f90 (code 1)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Apr 2022 17:44:50 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Couldn-t-use-a-integer-parameter-in-submodules/m-p/1373668#M160860</guid>
      <dc:creator>MehdiChinoune</dc:creator>
      <dc:date>2022-04-01T17:44:50Z</dc:date>
    </item>
    <item>
      <title>Re: Couldn't use a integer parameter in submodules</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Couldn-t-use-a-integer-parameter-in-submodules/m-p/1373672#M160861</link>
      <description>&lt;P&gt;&lt;a href="https://community.intel.com/t5/user/viewprofilepage/user-id/143907"&gt;@MehdiChinoune&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Please submit a support request toward bug resolution at Intel OSC if you have support subscription:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://supporttickets.intel.com/servicecenter?lang=en-US" target="_blank"&gt;https://supporttickets.intel.com/servicecenter?lang=en-US&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;In the meantime, please consider using the RESULT clause as shown below as a workaround (by the way, please seek employing dummy argument INTENT in your actual codes in case you don't have them):&lt;/P&gt;
&lt;LI-CODE lang="fortran"&gt;module aaa
  implicit none
  integer, parameter :: dp = selected_real_kind(15)
  interface
    module function foo(x) result(r)
      real(dp), intent(in) :: x
      real(dp) :: r
    end function foo
  end interface
end module aaa

submodule(aaa) bbb
  implicit none
contains
  module function foo(x) result(r)
    real(dp), intent(in) :: x
    real(dp) :: r
    r = x
  end function foo
end submodule bbb
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Apr 2022 17:53:31 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Couldn-t-use-a-integer-parameter-in-submodules/m-p/1373672#M160861</guid>
      <dc:creator>FortranFan</dc:creator>
      <dc:date>2022-04-01T17:53:31Z</dc:date>
    </item>
    <item>
      <title>Re: Couldn't use a integer parameter in submodules</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Couldn-t-use-a-integer-parameter-in-submodules/m-p/1373682#M160862</link>
      <description>&lt;P&gt;I wouldn't post here if I have support subscription.&lt;/P&gt;
&lt;P&gt;Thanks for the proposed workaround.&lt;/P&gt;
&lt;P&gt;I always use intent(in), intent(out), pure, elemental...etc in my program But since It's just a minimal example I didn't bother adding those attributes.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Apr 2022 19:00:17 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Couldn-t-use-a-integer-parameter-in-submodules/m-p/1373682#M160862</guid>
      <dc:creator>MehdiChinoune</dc:creator>
      <dc:date>2022-04-01T19:00:17Z</dc:date>
    </item>
    <item>
      <title>Re: Couldn't use a integer parameter in submodules</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Couldn-t-use-a-integer-parameter-in-submodules/m-p/1373882#M160869</link>
      <description>&lt;P&gt;Your code is lacking an import statement:&lt;/P&gt;
&lt;LI-CODE lang="fortran"&gt;module aaa
  implicit none
  integer, parameter :: dp = selected_real_kind(15)
  interface
    real(dp) module function foo(x)
      import :: dp   !&amp;lt;== need to import the parameter explicitly
      real(dp) :: x
    end function foo
  end interface
end module aaa

submodule(aaa) bbb
  implicit none
contains
  real(dp) module function foo(x)
    real(dp) :: x
    foo = x
  end function foo
end submodule bbb&lt;/LI-CODE&gt;
&lt;P&gt;With this Intel Fortran does accept the code.&lt;/P&gt;</description>
      <pubDate>Sun, 03 Apr 2022 14:40:25 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Couldn-t-use-a-integer-parameter-in-submodules/m-p/1373882#M160869</guid>
      <dc:creator>Arjen_Markus</dc:creator>
      <dc:date>2022-04-03T14:40:25Z</dc:date>
    </item>
    <item>
      <title>Re: Couldn't use a integer parameter in submodules</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Couldn-t-use-a-integer-parameter-in-submodules/m-p/1373883#M160870</link>
      <description>&lt;P&gt;The gfortran compiler accepts the original code, but it seems to me that this is inconsistent with other interface declarations, where you do need to import a symbol like dp. I do not know which one is right.&lt;/P&gt;</description>
      <pubDate>Sun, 03 Apr 2022 14:51:20 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Couldn-t-use-a-integer-parameter-in-submodules/m-p/1373883#M160870</guid>
      <dc:creator>Arjen_Markus</dc:creator>
      <dc:date>2022-04-03T14:51:20Z</dc:date>
    </item>
    <item>
      <title>Re: Couldn't use a integer parameter in submodules</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Couldn-t-use-a-integer-parameter-in-submodules/m-p/1373886#M160871</link>
      <description>&lt;P&gt;&lt;a href="https://community.intel.com/t5/user/viewprofilepage/user-id/75329"&gt;@Arjen_Markus&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Your posts here perhaps reveal the root cause of the issue with Intel Fortran compiler i.e., the compiler developer(s) too have not looked adequately into the standard even though the change has only been in effect for over a dozen years now!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The key aspect to notice in the reproducer in the original post is the MODULE clause with the function `foo`.&amp;nbsp; This is part of the functionality introduced way back in Fortran 2008 to support SUBMODULEs.&amp;nbsp; With such MODULE subprograms, the scoping rules are different and the IMPORT statement is not needed.&amp;nbsp; You could have realized this also from the workaround I posted upthread.&lt;/P&gt;</description>
      <pubDate>Sun, 03 Apr 2022 15:42:16 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Couldn-t-use-a-integer-parameter-in-submodules/m-p/1373886#M160871</guid>
      <dc:creator>FortranFan</dc:creator>
      <dc:date>2022-04-03T15:42:16Z</dc:date>
    </item>
    <item>
      <title>Re: Couldn't use a integer parameter in submodules</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Couldn-t-use-a-integer-parameter-in-submodules/m-p/1374000#M160873</link>
      <description>&lt;P&gt;Hm, I overlooked your workaround.&amp;nbsp; So, the analysis of the code for submodules is only partially wrong. Still a bug though ;).&lt;/P&gt;</description>
      <pubDate>Mon, 04 Apr 2022 06:48:37 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Couldn-t-use-a-integer-parameter-in-submodules/m-p/1374000#M160873</guid>
      <dc:creator>Arjen_Markus</dc:creator>
      <dc:date>2022-04-04T06:48:37Z</dc:date>
    </item>
    <item>
      <title>Re:Couldn't use a integer parameter in submodules</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Couldn-t-use-a-integer-parameter-in-submodules/m-p/1374181#M160885</link>
      <description>&lt;P&gt;I filed a bug report, CMPLRLLVM-36605, for you.&lt;/P&gt;&lt;P&gt;And, yes, you see the same messages with ifort and ifx since they share the same front-end. &lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 04 Apr 2022 19:27:15 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Couldn-t-use-a-integer-parameter-in-submodules/m-p/1374181#M160885</guid>
      <dc:creator>Barbara_P_Intel</dc:creator>
      <dc:date>2022-04-04T19:27:15Z</dc:date>
    </item>
    <item>
      <title>Re:Couldn't use a integer parameter in submodules</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Couldn-t-use-a-integer-parameter-in-submodules/m-p/1585674#M171541</link>
      <description>&lt;P&gt;I compiled with ifx and ifort that were released last week with 2024.1. Those erroneous error messages are gone.&lt;/P&gt;&lt;P&gt;Please try the new compilers.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 02 Apr 2024 21:02:56 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Couldn-t-use-a-integer-parameter-in-submodules/m-p/1585674#M171541</guid>
      <dc:creator>Barbara_P_Intel</dc:creator>
      <dc:date>2024-04-02T21:02:56Z</dc:date>
    </item>
  </channel>
</rss>

