<?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 See section 15.3.7 of the in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/iso-c-binding-and-indefinite-number-of-arguments/m-p/1055682#M116294</link>
    <description>&lt;P&gt;See section 15.3.7 of the Fortran 2008 standard (or see 15.2.6 of the Fortran 2003 standard):&lt;/P&gt;

&lt;P&gt;"NOTE 15.20&lt;BR /&gt;
	The C language allows specification of a C function that can take a variable number of arguments (ISO/IEC&lt;BR /&gt;
	9899:1999, 7.15). This part of ISO/IEC 1539 does not provide a mechanism for Fortran procedures to&lt;BR /&gt;
	interoperate with such C functions."&lt;/P&gt;</description>
    <pubDate>Sat, 05 Jul 2014 15:49:00 GMT</pubDate>
    <dc:creator>mecej4</dc:creator>
    <dc:date>2014-07-05T15:49:00Z</dc:date>
    <item>
      <title>iso_c_binding and indefinite number of arguments</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/iso-c-binding-and-indefinite-number-of-arguments/m-p/1055681#M116293</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I am trying to call a C subroutine with an indefinite number of arguments from a Fortran code. I have written something that work ok when using gcc/gfortran (various versions) but I get a segfault with icc/ifort. Here is a simplified version of my code which reproduces the segfault with intel compiler v14 and v15_beta.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;The C routine&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;#include &amp;lt;stdarg.h&amp;gt;
#include &amp;lt;stdio.h&amp;gt;

void va(int in, ...)
{

  int *out;

  printf("The input  value is: %2d\n",in);
  
  va_list varg_list;
  
  va_start(varg_list, in);
  out = va_arg(varg_list, int*);
  *out = in;
  va_end(varg_list);

}
  
&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;The Fortran calling code&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;program vaf
  use iso_c_binding
  integer(c_int), target  :: in, out

  interface
     subroutine va(in, out) bind(C)
       use iso_c_binding
       integer(c_int), value :: in
       type(c_ptr), value :: out
     end subroutine va
  end interface

  in = 15

  call va(in, c_loc(out))
  write(*,'("The output value is: ",i2)')out
  stop
end program vaf
&lt;/PRE&gt;

&lt;P&gt;I don't really know whether this code is compliant or not because I couldn't find much info about this topic on reference books nor on the net. Therefore I can't really tell whether this is a compiler bug or just a broken code. Can anybody help?&lt;/P&gt;

&lt;P&gt;Thanks,&lt;/P&gt;

&lt;P&gt;Alfredo&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 05 Jul 2014 13:36:22 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/iso-c-binding-and-indefinite-number-of-arguments/m-p/1055681#M116293</guid>
      <dc:creator>Alfredo</dc:creator>
      <dc:date>2014-07-05T13:36:22Z</dc:date>
    </item>
    <item>
      <title>See section 15.3.7 of the</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/iso-c-binding-and-indefinite-number-of-arguments/m-p/1055682#M116294</link>
      <description>&lt;P&gt;See section 15.3.7 of the Fortran 2008 standard (or see 15.2.6 of the Fortran 2003 standard):&lt;/P&gt;

&lt;P&gt;"NOTE 15.20&lt;BR /&gt;
	The C language allows specification of a C function that can take a variable number of arguments (ISO/IEC&lt;BR /&gt;
	9899:1999, 7.15). This part of ISO/IEC 1539 does not provide a mechanism for Fortran procedures to&lt;BR /&gt;
	interoperate with such C functions."&lt;/P&gt;</description>
      <pubDate>Sat, 05 Jul 2014 15:49:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/iso-c-binding-and-indefinite-number-of-arguments/m-p/1055682#M116294</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2014-07-05T15:49:00Z</dc:date>
    </item>
    <item>
      <title>Mecej4,</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/iso-c-binding-and-indefinite-number-of-arguments/m-p/1055683#M116295</link>
      <description>&lt;P&gt;Mecej4,&lt;/P&gt;

&lt;P&gt;thanks for your prompt response. This definitely answers the question.&lt;/P&gt;

&lt;P&gt;Kind regards,&lt;/P&gt;

&lt;P&gt;Alfredo&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 06 Jul 2014 14:12:18 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/iso-c-binding-and-indefinite-number-of-arguments/m-p/1055683#M116295</guid>
      <dc:creator>Alfredo</dc:creator>
      <dc:date>2014-07-06T14:12:18Z</dc:date>
    </item>
  </channel>
</rss>

