<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated on Sun, 22 Nov 2009 13:58:19 -0800 -->
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <atom:link href="http://software.intel.com/en-us/articles/intel-c-compiler-for-mac-os-x-kb/type/technical-notes/feed/" rel="self" type="application/rss+xml" />
    <title>Intel Software Network articles feed</title>
    <link>http://software.intel.com/en-us/articles/intel-c-compiler-for-mac-os-x-kb/technical-notes/</link>
    <description></description>
    <language>en-us</language>
    <item>
      <title>Memory allocation results in segmentation violation</title>
      <description><![CDATA[ <br />
<div id="art_pre_template"><b>Problem : <br /></b><br />I observe that when I compiled the following test case using default flag, its working properly. When I disabled optimization using flag -O0, it working for array size 10000, but unfortunately its giving segmentation fault error for size 100000.<br /><br />$ cat mytest1.c<br />// mytest1.c<br /><br />#include &lt;sys/time.h&gt;<br />#include &lt;time.h&gt;<br />#include&lt;stdio.h&gt;<br /><br />#define SIZE 1024 // Size = 1G<br />int main(int argc, char *argv[])<br />{<br />     float *a; //DB Init<br /><br />     long i,size=0,j;<br />     float sum=0;<br />     int k=0;<br />     int return_value;<br /><br /><br />     sscanf(argv[1], "%ld", &amp;size);<br />     printf("\n Size before Allocation = %ld\n",size);<br />     a=(float *) malloc (sizeof(float)* (size+128));<br /><br />     printf("Value of return from malloc = %d",return_value);<br /><br />     if (a == NULL){<br />         printf("\n\n ERROR: Memory Allocation not possible\n\n");<br />         exit(-1);<br />     }<br />     else<br />     {<br />         printf("Value of return pointer after memory allocation = %ld",a);<br />         printf("\n\n probing a[0]\n");<br />         a[0] = 0.;<br />         printf("probing a[%ld]\n", size-1);<br />         a[size-1] = 0.;<br />         printf("probing succeeded\n");<br />         return 0;<br />    }<br /><br />    for(i=0;i&lt; size; i++){<br />        sum+=a[i];<br />    }<br />    printf("\n Addition Complete, # of Element= %ld\n", size);<br />    free((void *)a);<br />    return 0;<br />}<br /><br /><br />$ icc -O0 mytest1.c <br />$ ./a.out 100000<br /><br />Size before Allocation = 100000<br />Value of return pointer after memory allocation = -1788305392<br /><br />probing a[0]<br />Segmentation fault<br /><br />$ icc mytest1.c <br />$ ./a.out 100000<br /><br />Size before Allocation = 100000<br />Value of return pointer after memory allocation = 182895288336<br /><br />probing a[0]<br />probing a[99999]<br />probing succeeded<br /><br /><br /><b>Environment : </b><br /><br />Intel C++ compiler, Linux x86_64<br /><br /><b>Root Cause : </b><br /><br />Implicitly declared malloc() returns improper address pointer and the application crashes. The compiler must know the function signature to handle it properly. <br /><br /><b>Resolution : </b><br /><br />Implicitly declared malloc() returns improper address pointer. The malloc() declaration in stdlib.h is as given below:<br /><br />void * malloc ( size_t size );<br /><br />The compiler must know the function signature to handle it properly. If we do not provide declaration to compiler, the compiler assumes that the value returned by the function is integer. This is called implicit declaration. <br /><br />The implicit declaration will force void pointer returned from malloc() to integer, the integer is converted again to float pointer. These conversions results in improper value for returned memory address and the application crashes.<br /><br /></div> ]]></description>
      <link>http://software.intel.com/en-us/articles/memory-allocation-results-in-segmentation-violation</link>
      <pubDate>Thu, 27 Aug 2009 23:40:59 -0700</pubDate>
      <comments>http://software.intel.com/en-us/articles/memory-allocation-results-in-segmentation-violation#comments</comments>
      <guid isPermaLink="true">http://software.intel.com/en-us/articles/memory-allocation-results-in-segmentation-violation</guid>
      <category>Intel® C++ Compiler for Linux* Knowledge Base</category>
      <category>Intel® C++ Compiler for Mac OS X* Knowledge Base</category>
    </item>
    <item>
      <title>Intel thread affinity environment variable for OpenMP*</title>
      <description><![CDATA[ <br />
<div id="art_pre_template"><b>Problem : <br /></b><br />I am using the Intel® compiler and openMP* to parallelize some work as follows:<br /><br />
<pre name="code" class="cpp">#pragma omp parallel num_threads(4)
{
DoWork();
}</pre>
<br />I would d like to experiment with Intel's thread affinity feature for OpenMP but I a unsure of exactly how to use the environment variable (for example, where do I place the environment statement in my code?).<br /><br />Could you give a little example showing proper usage and where to place the statement ? <br /><br /><br /><b>Environment : </b><br />Intel C++ compiler, Linux*, Mac OS* X, Windows*<br /><br /><b>Resolution : </b><br /><br /><br />Intel thread affinity environment variable KMP_AFFINITY for openMP is explained in Compiler Intel® compiler user guide topic “Thread Affinity Interface (Linux* and Windows*)”. You may review the topic for detailed information.<br /><br />There are many ways to set the thread affinity using KMP_AFFINITY. I am providing an example below. In the example I am mapping OpenMP threads 0, 1, 2 and 3 to OS processor 3, 2, 1 and 0 respectively. <br /><br />
<pre name="code" class="cpp">$ cat tstcase.cpp
// tstcase.cpp
// Thread afinity interface
//


#include &lt;omp.h&gt;
#include &lt;iostream&gt;
using namespace std;

#define N 1000

int main ()
{
cout &lt;&lt; "Starting openmp test." &lt;&lt; endl;

int i;
float a[N], b[N], c[N], d[N];

/* Some initializations */
for (i=0; i &lt; N; i++)
{
a[i] = i * 1.5;
b[i] = i + 22.35;
}

#pragma omp parallel shared(a,b,c,d) private(i)
{

#pragma omp sections nowait
{

// Section #1
//
#pragma omp section
{
cout &lt;&lt; "Section #1." &lt;&lt; endl;
for (i=0; i &lt; N; i++)
c[i] = a[i] + b[i]; // End of section #1
a[0] = 3.45;
}

// Section #2
//
#pragma omp section
{
cout &lt;&lt; "Section #2." &lt;&lt; endl;
for (i=0; i &lt; N; i++)
d[i] = a[i] * b[i]; // End of section #2
a[1] = 5.67;
}

} // End of sections

} // End of parallel

cout &lt;&lt; "Exiting openmp test." &lt;&lt; endl;
return 0;
}</pre>
<br />$ icc -openmp tstcase.cpp<br />$ export KMP_AFFINITY="verbose,proclist=[3,2,1,0]"<br />$ ./a.out<br />OMP: Warning #63: KMP_AFFINITY: proclist specified, setting affinity type to "explicit".<br />Starting openmp test.<br />OMP: Info #149: KMP_AFFINITY: Affinity capable, using global cpuid instr info<br />OMP: Info #154: KMP_AFFINITY: Initial OS proc set respected: {0,1,2,3}<br />OMP: Info #156: KMP_AFFINITY: 4 available OS procs<br />OMP: Info #157: KMP_AFFINITY: Uniform topology<br />OMP: Info #159: KMP_AFFINITY: 2 packages x 2 cores/pkg x 1 threads/core (4 total cores)<br />OMP: Info #160: KMP_AFFINITY: OS proc to physical thread map ([] =&gt; level not in map):<br />OMP: Info #168: KMP_AFFINITY: OS proc 0 maps to package 0 core 0 [thread 0]<br />OMP: Info #168: KMP_AFFINITY: OS proc 2 maps to package 0 core 1 [thread 0]<br />OMP: Info #168: KMP_AFFINITY: OS proc 1 maps to package 3 core 0 [thread 0]<br />OMP: Info #168: KMP_AFFINITY: OS proc 3 maps to package 3 core 1 [thread 0]<br />OMP: Info #147: KMP_AFFINITY: Internal thread 0 bound to OS proc set {3}<br />OMP: Info #147: KMP_AFFINITY: Internal thread 1 bound to OS proc set {2}<br />OMP: Info #147: KMP_AFFINITY: Internal thread 2 bound to OS proc set {1}<br />OMP: Info #147: KMP_AFFINITY: Internal thread 3 bound to OS proc set {0}<br />Section #1.<br />Section #2.<br />Exiting openmp test.<br /><br /><br /><br /></div> ]]></description>
      <link>http://software.intel.com/en-us/articles/intel-thread-affinity-environment-variable-for-openmp</link>
      <pubDate>Mon, 24 Aug 2009 02:31:41 -0700</pubDate>
      <comments>http://software.intel.com/en-us/articles/intel-thread-affinity-environment-variable-for-openmp#comments</comments>
      <guid isPermaLink="true">http://software.intel.com/en-us/articles/intel-thread-affinity-environment-variable-for-openmp</guid>
      <category>Intel® C++ Compiler for Linux* Knowledge Base</category>
      <category>Intel® C++ Compiler for Mac OS X* Knowledge Base</category>
      <category>Intel® C++ Compiler for Windows* Knowledge Base</category>
    </item>
    <item>
      <title>Error while copying license file - Intel(R) Compilers for Mac OS X</title>
      <description><![CDATA[ <br />
<div><strong>Problem : <br /><br /></strong>During installation, an error message of "Error while copying license file. Please make sure you have write permission to the license folder" will result if the user does not have write permission to the directory /Users/Shared/Library/Application\ Support/Intel/Licenses. <br /><br /><strong></strong></div>
<div><strong>Environment : <br /><br /></strong>Mac OS X, Intel Compiler 11.1</div>
<div>A related article pertaining to Mac OS X, Intel Compiler 9.1, 10.1, 11.0 can be found <a href="http://software.intel.com/en-us/articles/invalid-serial-number-intelr-compilers-for-mac-os-x/">here</a>.<br /><br /><br /><strong>Root Cause : <br /><br /></strong>The error "Error while copying license file. Please make sure you have write permissions to the license folder." will appear if the user does not have write permission to the directory /Users/Shared/Library/Application\ Support/Intel/Licenses.<strong> <br /><br /></strong>This directory by default has write permission enabled, however, installation of other third party products such as Adobe products might change the permission for this directory. This change in permission will result in an error during installation of Intel(R) Compiler Products because the installer can not create a license file in this directory.<br /><br />Even if the user provide their own license file instead of a serial number, the error will still occur if the installer can not copy the license to the directory /Users/Shared/Library/Application\ Support/Intel/Licenses.<br /><br /><br /><br /><strong>Resolution : <br /><br /></strong>Assuming that you have a valid serial number or product license, the solution is to enable write permission for the directory Users/Shared/Library/Application\ Support/Intel/Licenses.<br /><br /><br /><br /></div> ]]></description>
      <link>http://software.intel.com/en-us/articles/error-while-copying-license-file-intelr-compilers-for-mac-os-x</link>
      <pubDate>Mon, 03 Aug 2009 11:27:03 -0700</pubDate>
      <comments>http://software.intel.com/en-us/articles/error-while-copying-license-file-intelr-compilers-for-mac-os-x#comments</comments>
      <guid isPermaLink="true">http://software.intel.com/en-us/articles/error-while-copying-license-file-intelr-compilers-for-mac-os-x</guid>
      <category>Tools</category>
      <category>Intel® C++ Compiler for Mac OS X* Knowledge Base</category>
      <category>Intel® Fortran Compiler for Mac OS X* Knowledge Base</category>
    </item>
    <item>
      <title>Different result of Volatile variables between icc and vc</title>
      <description><![CDATA[ <div id="art_pre_template"><b>Problem : </b><br /><br />We used keyword "volatile" as below when defining a variable,:<br /><br />volatile int i=5; <br /><br />The volatile has multiple meanings. To a compiler writer it means to take no code generation shortcuts when accessing such an object. "Volatile" is reminder to compiler to not suppose or guess some conditions when optimized, the variable could be change by some unexpected elements anytime. <br /><br />So, the variable i should be stored in SRAM, every time we used it, we read it from SRAM. <br /><br />Let's see a simple case: <br /><br />// tstcase.c<br />include &lt;stdio.h&gt;<br />include &lt;stdlib.h&gt;<br /><br />void foo()<br />{<br />volatile int i=1, j=1;<br />i=(i++)+(j++)+2;<br />j=i=i++;<br />printf("i=%d,j=%d\n",i,j);<br /><br />}<br /><br />Using Intel C++ compiler, result is:<br /><br />i=3,j=2 (same result with gcc)<br /><br />Using VC compiler, result is <br /><br />i=6,j=5 <br /><br />I thinks that i=(i++)+(j++)+2 was translated to:<br /><br />Intel C++ compiler:<br /><br />t=t+t1+2; (t is equal to 4)<br />t++; (t is equal to 1, then execute t++, t is equal to 2)<br />t1++; (t1 is equal to 2)<br />Then, j=i=i++;<br />Output is i=3,j=2<br /><br />Microsoft C++ compiler :<br /><br />t=t+t1+2; (t is equal to 4)<br />t++; (t is equal to 5)<br />t1++; (t1 is equal to 2)<br />Then, j=i=i++;<br />Output is i=6,j=5. <br /><br />If we did not use Volatile, we got same result(i=6,j=5) no matter which compiler used. If integrated Intel C++ compiler to VS2008, compiled both with VC and icl , we got different result. <br /><br /><b>Environment : </b><br />Windows, Linux , Intel C++ compiler, Microsoft C++ compiler, gcc<br /><br /><b>Root Cause : </b><br />The statements use language constructs that have undefined behaviour according to C/C++ standard:<br /><br /><b>Resolution : </b><br /><br />The test uses language constructs that have undefined behaviour according to C/C++ standard:<br /><br />&gt;&gt;&gt; i=(i++)+(j++)+2;<br />&gt;&gt;&gt; j=i=i++;<br /><br />The value of i is being modified more than once between two sequence points. Refer to the rules for expressions (section 5, paragraph 4 of the ISO C++ standard):<br /><br />"Except where noted, the order of evaluation of operands of<br />individual operators and subexpressions of individual<br />expressions, and the order in which side effects take place,<br />is unspecified. Between the previous and next sequence<br />point a scalar object shall have its stored value modified at<br />most once by the evaluation of an expression. Furthermore,<br />the prior value shall be accessed only to determine the value<br />to be stored. The requirements of this paragraph shall be met<br />for each allowable ordering of the subexpressions of a full<br />expression; otherwise the behavior is undefined. <br /><br />[Example:<br />i = v[i++]; // the behavior is unspecified<br />i = 7, i++, i++; // i becomes 9<br />i = ++i + 1; // the behavior is unspecified<br />i = i + 1; // the value of i is incremented<br />-end example]"<br /><br /><br /></div> ]]></description>
      <link>http://software.intel.com/en-us/articles/different-result-of-volatile-variables-between-icc-and-vc</link>
      <pubDate>Mon, 13 Jul 2009 23:20:19 -0700</pubDate>
      <comments>http://software.intel.com/en-us/articles/different-result-of-volatile-variables-between-icc-and-vc#comments</comments>
      <guid isPermaLink="true">http://software.intel.com/en-us/articles/different-result-of-volatile-variables-between-icc-and-vc</guid>
      <category>Intel® Parallel Composer</category>
      <category>Intel® Compilers</category>
      <category>Intel® C++ Compiler for Linux* Knowledge Base</category>
      <category>Intel® C++ Compiler for Mac OS X* Knowledge Base</category>
      <category>Intel® C++ Compiler for Windows* Knowledge Base</category>
      <category>Intel® Parallel Composer Knowledge Base</category>
    </item>
    <item>
      <title>Cross compilation using Intel C++ compiler for Linux</title>
      <description><![CDATA[ <br />
<div id="art_pre_template"><strong>Problem : </strong><br />A question on the setup scripts of the Intel 11.0.064 compiler.<br /><br />If one sets up the Intel compile by sourcing /opt/intel/Compiler/11.0/064/bin/iccvars.csh intel64 then can one do a 32bit build with this setup if the compile line has arch i386 or -m32 in it? Is the Intel compiler behaves like gcc? Can it do both 32 bit and 64 bit builds from the same compiler setup ?<br /><br />What about the other way. If one sets up the the 11.0/064/bin/iccvars.csh ia32 compiler, can it do 64 bit builds with -m64 or -arch x86_64. <br /><br />Is there a difference in the ia32 and intel64 compilers ? <br /><br /><br /><strong>Environment :  <br /><br />Linux, MAC OS, Intel C++ compiler </strong><br /><br /><br /><strong>Resolution : </strong><br /><br />The Intel C++ compiler 11.0 is a native Intel 64 application on Intel 64 Linux. The older versions used to be a 32-bit cross compiler in the past. The compiler can generate native Intel64 code and cross compile 32-bit code. The Intel C++ compiler on ia32 Linux is the classic 32-bit which installs and runs on both 32-bit and Intel64 systems and can generate 32-bit code and cross compile Intel64 code. <br /><br />Users were asking for native Intel64 compilers on Intel64 systems to handle larger binaries to meet their needs, so Intel created the native Intel64 compiler.<br /><br /></div> ]]></description>
      <link>http://software.intel.com/en-us/articles/cross-compilation-using-intel-c-compiler-for-linux</link>
      <pubDate>Tue, 23 Jun 2009 23:52:11 -0700</pubDate>
      <comments>http://software.intel.com/en-us/articles/cross-compilation-using-intel-c-compiler-for-linux#comments</comments>
      <guid isPermaLink="true">http://software.intel.com/en-us/articles/cross-compilation-using-intel-c-compiler-for-linux</guid>
      <category>Intel® C++ Compiler for Linux* Knowledge Base</category>
      <category>Intel® C++ Compiler for Mac OS X* Knowledge Base</category>
    </item>
    <item>
      <title>Abstract class type  not allowed as a type for parameter</title>
      <description><![CDATA[ <br />
<div id="art_pre_template"><strong>Problem : <br /></strong>I encounter an error when compiling "parameter of abstract class type "type" is not allowed", as described in http://software.intel.com/en-us/articles/cdiag646/. Does anybody know why and how to fix it?<br /><br /><strong>Environment : <br /></strong>Windows, Linux, Mac and Intel C++ compiler.<br /><br /><br /><strong>Resolution : </strong><br /><br /><br />The problem is you are trying to declare a parameter that has the type of an abstract base class.<br /><br />Abstract classes are designed to be only interfaces to real classes because they have one or<br />more pure virtual functions, i.e.:<br />class abstract {<br />virtual void foo() = 0; // pure virtual function since it is declared with = 0<br />};<br />void foo(abstract); // not allowed since the class is abstract<br /><br />The workaround would be to only use pointers or references to the abstract class as parameters, or change the type to a non-abstract class that is derived from the abstract class or change the class so it is no longer abstract, i.e. define the virtual functions instead of declaring them pure virtual.<br /><br /></div> ]]></description>
      <link>http://software.intel.com/en-us/articles/abstract-class-type-not-allowed-as-a-type-for-parameter</link>
      <pubDate>Sun, 14 Jun 2009 23:02:04 -0700</pubDate>
      <comments>http://software.intel.com/en-us/articles/abstract-class-type-not-allowed-as-a-type-for-parameter#comments</comments>
      <guid isPermaLink="true">http://software.intel.com/en-us/articles/abstract-class-type-not-allowed-as-a-type-for-parameter</guid>
      <category>Intel C++ Compiler and Performance Library for QNX* Neutrino* RTOS Knowledge Base</category>
      <category>Intel® C++ Compiler for Linux* Knowledge Base</category>
      <category>Intel® C++ Compiler for Mac OS X* Knowledge Base</category>
      <category>Intel® C++ Compiler for Windows* Knowledge Base</category>
      <category>Intel® Parallel Composer Knowledge Base</category>
    </item>
    <item>
      <title>ISO/IEC Standards language conformance for Intel C++ compiler</title>
      <description><![CDATA[ The Intel C++ compiler option /Qstd=val or –std=val could be used to get the specific version of ISO/IEC standards language conformance for the compiler. <br /><br />The possible values are for “val” are given below:<br /><br />c89 - Conforms to the ISO/IEC 9899:1990 International Standard.<br /><br />c99 - Conforms to The ISO/IEC 9899:1999 International Standard.<br /><br />gnu89 - Conforms to ISO C90 plus GNU* extensions.<br /><br />gnu++98 - Conforms to the 1998 ISO C++ standard plus GNU extensions.<br /><br />c++0x - Enable support for the following C++0x features. Please refer to Intel C++ compiler documentation for details.<br /><br />The default for Intel C++ compiler 11.0 are as given below:<br /><br />-std=gnu89 - default for C, Conforms to ISO C90 plus GNU extensions.<br />-std=gnu++98 - default for C++, Conforms to the 1998 ISO C++ standard plus GNU* extensions.<br />/Qstd=c89 - Conforms to the ISO/IEC 9899:1990 International Standard.<br /><br /> ]]></description>
      <link>http://software.intel.com/en-us/articles/iso-iec-standards-language-conformance-for-intel-c-compiler</link>
      <pubDate>Thu, 04 Jun 2009 02:01:38 -0700</pubDate>
      <comments>http://software.intel.com/en-us/articles/iso-iec-standards-language-conformance-for-intel-c-compiler#comments</comments>
      <guid isPermaLink="true">http://software.intel.com/en-us/articles/iso-iec-standards-language-conformance-for-intel-c-compiler</guid>
      <category>Intel C++ Compiler and Performance Library for QNX* Neutrino* RTOS Knowledge Base</category>
      <category>Intel® C++ Compiler for Linux* Knowledge Base</category>
      <category>Intel® C++ Compiler for Mac OS X* Knowledge Base</category>
      <category>Intel® C++ Compiler for Windows* Knowledge Base</category>
      <category>Intel® Parallel Composer Knowledge Base</category>
    </item>
    <item>
      <title>Intel C++ Compiler compiles code without necessary header</title>
      <description><![CDATA[ <br />
<div id="art_pre_template"><strong>Problem : </strong><br /><br />The Intel® C++ compiler for Linux compiles the code on the m/cs with gcc 4.1.3 but fails on m/cs with gcc 4.3. On the latest gcc it needs a header<br />#include &lt;locale&gt;<br /><br />Without this, using the locale methods is in error, apparently. <br /><br /><br /><strong>Environment :  Linux*, MacOS X*</strong><br /><br /><br /><strong>Resolution : </strong><br />The Intel C++ compiler uses the gcc development environment in use. If you set the environment to use gcc 4.1 then icc will use headers from gcc 4.1. If you set gcc 4.3 development environment, icc will use gcc 4.3 headers.<br /><br />Intel compiler is matching the behavior of the active gcc from which it inherits the headers and library. <br /><br />The following code when compiled under gcc 4.1.2 development environment using Intel C++ compiler 11.0.083 compiles without any problem. When compiling the same under gcc 4.3.2 development environment the Intel C++ compiler gives error. When we use “#include &lt;locale&gt;” l header it works. The gcc also exhibit same behavior.<br /><br />// tst_locale.cpp<br /><br />#include &lt;iostream&gt;<br />#include &lt;sstream&gt;<br />#include &lt;time.h&gt;<br /><br />#ifdef NEED_LOCALE_HEADER<br />#include &lt;locale&gt;<br />#endif<br /><br /><br />using namespace std;<br /><br />class DateTime {<br />public:<br />DateTime();<br />virtual ~DateTime() {}<br />operator tm() const;<br />protected:<br />long i;<br />};<br /><br />class EpsBufr {<br />public:<br />EpsBufr();<br />virtual ~EpsBufr() {};<br />void doit();<br />protected:<br />DateTime base_;<br />};<br /><br />DateTime::operator tm() const<br />{<br />struct tm tm_date = tm();<br />return tm_date;<br />}<br /><br />void EpsBufr::doit() {<br /><br />ostringstream out;<br />tm convert = base_;<br />locale loc("");<br />const std::time_put&lt;char&gt;&amp; tfac = use_facet&lt;time_put&lt;char&gt; &gt;(loc);<br />string format = "Forecast VT %A %e %B %Y %H UTC";<br />tfac.put(out, out, ' ', &amp;convert, format.c_str(), format.c_str()+format.length());<br />}<br /><br />$ gcc -v<br />Using built-in specs.<br />Target: x86_64-unknown-linux-gnu<br />Configured with: ./configure --prefix=/opt/spdtools/compiler/ia32e/gcc-4.3.2 --with-gcc --enable-languages=c,c++<br />Thread model: posix<br />gcc version 4.3.2 (GCC)<br /><br />$ icc -V<br />Intel(R) C Intel(R) 64 Compiler Professional for applications running on Intel(R) 64, Version 11.0 Build 20090318 Package ID: l_cproc_p_11.0.083<br />Copyright (C) 1985-2009 Intel Corporation. All rights reserved.<br /><br />$icc -c tst_local.cpp<br />tst_local.cpp(45): error: incomplete type is not allowed<br />tfac.put(out, out, ' ', &amp;convert, format.c_str(), format.c_str()+format.length());<br />^<br /><br />/net/spd64/opt/spdtools/compiler/ia32e/gcc-4.3.2/bin/../include/c++/4.3.2/bits/locale_classes.tcc(112): error: incomplete type is not allowed<br />const size_t __i = _Facet::id._M_id();<br />^<br />detected during instantiation of "const _Facet &amp;std::use_facet&lt;_Facet&gt;(const std::locale &amp;) [with _Facet=std::time_put&lt;char, std::ostreambuf_iterator&lt;char, std::char_traits&lt;char&gt;&gt;&gt;]" at line 43 of "tst_local.cpp"<br /><br />compilation aborted for tst_local.cpp (code 2)<br /><br />$ icc -c -DNEED_LOCALE_HEADER tst_local.cpp<br /><br /><br /></div> ]]></description>
      <link>http://software.intel.com/en-us/articles/intel-c-compiler-compiles-code-without-necessary-header</link>
      <pubDate>Fri, 22 May 2009 00:10:08 -0700</pubDate>
      <comments>http://software.intel.com/en-us/articles/intel-c-compiler-compiles-code-without-necessary-header#comments</comments>
      <guid isPermaLink="true">http://software.intel.com/en-us/articles/intel-c-compiler-compiles-code-without-necessary-header</guid>
      <category>Intel® C++ Compiler for Linux* Knowledge Base</category>
      <category>Intel® C++ Compiler for Mac OS X* Knowledge Base</category>
    </item>
    <item>
      <title>Inline Assembly, use-msasm and fasm-blocks</title>
      <description><![CDATA[ <br />
<div id="art_pre_template"><strong>Problem : </strong><br /><br />I was looking for "fasm-blocks" decription in "Intel C++ Compiler User &amp; Reference Guide" (304968-022US) which seems to be the latest document with release of ICC-v11.0. The agnostic about it is "fasm-blocks" works with ICC-11.0 on Linux x86_64 but the descriptions about "fasm-blocks" is missing.<br /><br />Could Intel describe it's meaning, uses, also demonstrate with an example currently and latter incorporate in it's feature forthcoming ICC documents.<br /><br />Can I have Intel Assembler latest documents or it's links to download w.r.t Intel 64 on Linux x86_64 where one can understand and analyze Intel Assembly language?<br /><br /><br /><strong>Environment :  <br /></strong><br />Linux* and MacOS X*<br /><br /><strong>Resolution : </strong><br /><br /><br />Intel C++ compiler uses gcc development environment on Linux and MAC. It supports GNU inline style assembly. <br /><br />Intel C++ compiler also supports Microsoft style inline assembly format in Linux. You can use -use-msasm to tell the compiler. The -fasm-blocks is also seems to be working.<br /><br />The -fasm-blocks option is provided on MAC for Microsoft style inline assembly.<br /><br />These options are described in Intel C++ compiler documentation, Document number: 304968-022US. There is small description of the inline assembly implementation in Intel C++ compiler in "Inline Assembly" topic. <br /><br />I am providing the code sample from the Intel C++ compiler documentation below for easy reference:<br /><br />---------------------------------------- gnu style inline assembly ------------------<br />$ cat tstcase_gnu.cpp<br />// inline assembly<br />// tstcase_gnu.cpp<br /><br />#ifdef _WIN64<br />#define INT64_PRINTF_FORMAT "I64"<br />#else<br />#define __int64 long long<br />#define INT64_PRINTF_FORMAT "L"<br />#endif<br />#include &lt;stdio.h&gt;<br />typedef struct {<br />__int64 lo64;<br />__int64 hi64;<br />} my_i128;<br />#define ADD128(out, in1, in2) \<br />__asm__("addq %2, %0; adcq %3, %1" :\<br />"=r"(out.lo64), "=r"(out.hi64) : \<br />"emr" (in2.lo64), "emr"(in2.hi64), \<br />"0" (in1.lo64), "1" (in1.hi64));<br />extern int main()<br />{<br />my_i128 val1, val2, result;<br />val1.lo64 = ~0;<br />val1.hi64 = 0;<br />val2.hi64 = 65;<br />ADD128(result, val1, val2);<br />printf("0x%016" INT64_PRINTF_FORMAT "x%016" INT64_PRINTF_FORMAT "x\n",<br />val1.hi64, val1.lo64);<br />printf("+0x%016" INT64_PRINTF_FORMAT "x%016" INT64_PRINTF_FORMAT "x\n",<br />val2.hi64, val2.lo64);<br />printf("------------------------------------\n");<br />printf("0x%016" INT64_PRINTF_FORMAT "x%016" INT64_PRINTF_FORMAT "x\n",<br />result.hi64, result.lo64);<br />return 0;<br />}<br /><br /><br />---------------------------------------- Microsoft style inline assembly ------------------<br /><br />$ cat tstcase_msasm.cpp<br />// inline assembly<br />// tstcase_msasm.cpp<br /><br />#ifdef _WIN64<br />#define INT64_PRINTF_FORMAT "I64"<br />#else<br />#define __int64 long long<br />#define INT64_PRINTF_FORMAT "L"<br />#endif<br />#include &lt;stdio.h&gt;<br />typedef struct {<br />__int64 lo64;<br />__int64 hi64;<br />} my_i128;<br />#define ADD128(out, in1, in2) \<br />{ \<br />__asm mov rax, in1.lo64 \<br />__asm mov rdx, in1.hi64 \<br />__asm add rax, in2.lo64 \<br />__asm adc rdx, in2.hi64 \<br />__asm mov out.lo64, rax \<br />__asm mov out.hi64, rdx \<br />}<br /><br />extern int main()<br />{<br />my_i128 val1, val2, result;<br />val1.lo64 = ~0;<br />val1.hi64 = 0;<br />val2.hi64 = 65;<br />ADD128(result, val1, val2);<br />printf("0x%016" INT64_PRINTF_FORMAT "x%016" INT64_PRINTF_FORMAT "x\n",<br />val1.hi64, val1.lo64);<br />printf("+0x%016" INT64_PRINTF_FORMAT "x%016" INT64_PRINTF_FORMAT "x\n",<br />val2.hi64, val2.lo64);<br />printf("------------------------------------\n");<br />printf("0x%016" INT64_PRINTF_FORMAT "x%016" INT64_PRINTF_FORMAT "x\n",<br />result.hi64, result.lo64);<br />return 0;<br />}<br /><br />You would need -use-msasm compiler option to compile tstcase_msasm.cpp. The -fasm-blocks is also seems to be working on Linux but this is intended for MAC OS.<br /></div> ]]></description>
      <link>http://software.intel.com/en-us/articles/inline-assemblty-use-msasm-and-fasm-blocks</link>
      <pubDate>Tue, 19 May 2009 01:28:36 -0700</pubDate>
      <comments>http://software.intel.com/en-us/articles/inline-assemblty-use-msasm-and-fasm-blocks#comments</comments>
      <guid isPermaLink="true">http://software.intel.com/en-us/articles/inline-assemblty-use-msasm-and-fasm-blocks</guid>
      <category>Intel® C++ Compiler for Linux* Knowledge Base</category>
      <category>Intel® C++ Compiler for Mac OS X* Knowledge Base</category>
    </item>
    <item>
      <title>Sample Programs Provided in the Intel® C++ Compiler</title>
      <description><![CDATA[ <!--CTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dt-->
<table border="0" cellpadding="0" cellspacing="15">
<tbody>
<tr>
<td class="bodycopy">
<p>There're up to 8 sample programs provided in the Intel® C++ Compiler to illustrate specific compiler optimizations and features like PGO, HPO, IPO, Vectorization, OpenMP*, Intrinsics.</p>
<p>The sample programs are installed under</p>
<ul>
<li>"<span class="courier">C:\Program Files\Intel\Compiler\C++\10.1.xxx\samples" for 10.1</span> </li>
<li>"C:\Program Files\Intel\Compiler\11.0\xxx\cpp\Samples\C++" for 11.0 </li>
<li>"C:\Program Files\Intel\Compiler\11.1\xxx\Samples\en_US\C++" for 11.1 </li>
</ul>
<p>Please check the samples.html located at this directory for detail information.</p>
</td>
</tr>
</tbody>
</table> ]]></description>
      <link>http://software.intel.com/en-us/articles/performance-tools-for-software-developers-sample-programs-provided-in-the-intel-c-compiler</link>
      <pubDate>Thu, 06 Nov 2008 09:42:19 -0800</pubDate>
      <comments>http://software.intel.com/en-us/articles/performance-tools-for-software-developers-sample-programs-provided-in-the-intel-c-compiler#comments</comments>
      <guid isPermaLink="true">http://software.intel.com/en-us/articles/performance-tools-for-software-developers-sample-programs-provided-in-the-intel-c-compiler</guid>
      <category>Intel® C++ Compiler for Linux* Knowledge Base</category>
      <category>Intel® C++ Compiler for Mac OS X* Knowledge Base</category>
      <category>Intel® C++ Compiler for Windows* Knowledge Base</category>
    </item>
  </channel></rss>