<?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 Hi David in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Heap-Corruption-on-Deallocate/m-p/937716#M89267</link>
    <description>&lt;P&gt;Hi David&lt;/P&gt;

&lt;P&gt;I loaded provided by you minidump file and I did not have any problems with loading&amp;nbsp;Microsoft public symbols.I quickly looked at call stack dump and I saw that heap corruption was signaled/detected probably by&amp;nbsp;&amp;nbsp;RtlpCoalesceFreeBlocks+0x84c function operating from kernel mode.This function was called by Win API HeapFree().Tomorrow I will post more detailed analysis.By the way I do not use ntsd.You can do everything from withing Gui version of windbg.&lt;/P&gt;

&lt;P&gt;In case that you did not properly set your symbol path,below I pasted the proper version of the symbol path&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;SRV*c:\symbols*http://msdl.microsoft.com/download/symbols&lt;/STRONG&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;*&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 14 Dec 2013 17:40:35 GMT</pubDate>
    <dc:creator>Bernard</dc:creator>
    <dc:date>2013-12-14T17:40:35Z</dc:date>
    <item>
      <title>Heap Corruption on Deallocate</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Heap-Corruption-on-Deallocate/m-p/937700#M89251</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;I have a complicated model - to convoluted to post here - and I am trying to debug some strange behavior. I occasionally get heap corruption errors at the end of the model run when it is deallocating memory.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;I have created a simple test program&amp;nbsp;&lt;A href="https://gist.github.com/dstuebe/7936460"&gt;hello.f90&lt;/A&gt; which reproduces some of the really strange behavior that I see in our application.&lt;/P&gt;

&lt;P&gt;Any time the bounds of an array are exceeded - shame on me - it is the programmer's fault, but this behavior makes it really hard to figure out! Depending on the index that is exceeded - first or second of a 2D array - the program will raise a heap corruption error on deallocation or proceed without error when compiled with optimization.&lt;/P&gt;

&lt;P&gt;Obviously the thing to do is compile with check all and get a trace back to the line where the error occurs - but this still seems like bad behavior. I am really curious if someone can at least explain what is happening here!&lt;/P&gt;

&lt;P&gt;Here is a gist of the code:&amp;nbsp;https://gist.github.com/dstuebe/7936460&lt;/P&gt;

&lt;P&gt;The exception raised by the OS is in the comments along with the version of Visual Studio/Fortran.&lt;/P&gt;

&lt;P&gt;Thanks&amp;nbsp;&lt;/P&gt;

&lt;P&gt;David&lt;/P&gt;</description>
      <pubDate>Thu, 12 Dec 2013 22:14:10 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Heap-Corruption-on-Deallocate/m-p/937700#M89251</guid>
      <dc:creator>David2</dc:creator>
      <dc:date>2013-12-12T22:14:10Z</dc:date>
    </item>
    <item>
      <title>What exactly do you expect to</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Heap-Corruption-on-Deallocate/m-p/937701#M89252</link>
      <description>&lt;P&gt;What exactly do you expect to happen if you write outside the bounds of an allocated array? This is called "memory corruption" and what you're seeing is that you have corrupted the memory allocator's free/used information. Fix your code. And if you built with bounds checking enabled, you'd get an error at the point of the problem.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Dec 2013 22:24:55 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Heap-Corruption-on-Deallocate/m-p/937701#M89252</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2013-12-12T22:24:55Z</dc:date>
    </item>
    <item>
      <title>I guess I would my bad</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Heap-Corruption-on-Deallocate/m-p/937702#M89253</link>
      <description>&lt;P&gt;I guess I would expect my bad programming to result in the same behavior regardless of the index I screwed up.&amp;nbsp;Can you explain why the behavior is different depending on which index is exceeded? That seems at least academically interesting.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;The real model code that I am trying to debug has some serious issues where arrays are allocated and indexed based on unvalidated user input&amp;nbsp;and since the error does not show up until the deallocation is called - sometime 100's of wall time hours in... it is hard to debug. Is there any way to tell at least which array caused the error for an&amp;nbsp;exe compiled with optimization (without bounds checking)? Say from a minidump file?&lt;/P&gt;</description>
      <pubDate>Thu, 12 Dec 2013 23:58:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Heap-Corruption-on-Deallocate/m-p/937702#M89253</guid>
      <dc:creator>David2</dc:creator>
      <dc:date>2013-12-12T23:58:00Z</dc:date>
    </item>
    <item>
      <title>Also posted to Stack Overflow</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Heap-Corruption-on-Deallocate/m-p/937703#M89254</link>
      <description>&lt;P&gt;Also posted to &lt;A href="http://stackoverflow.com/questions/20555557/free-error-heap-corruption-in-fortran-depends-on-the-index-that-is-out-of-boun"&gt;Stack Overflow&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Dec 2013 00:09:30 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Heap-Corruption-on-Deallocate/m-p/937703#M89254</guid>
      <dc:creator>David2</dc:creator>
      <dc:date>2013-12-13T00:09:30Z</dc:date>
    </item>
    <item>
      <title>The code that uses un</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Heap-Corruption-on-Deallocate/m-p/937704#M89255</link>
      <description>&lt;P&gt;The code that uses un-validated user input should have validation added. This would be lighter weight than bounds checking everything.&lt;/P&gt;

&lt;P&gt;You can also Right-Click on individual source files in the Solution Explorer of VS, select Properties, then enable bounds checking on individual files. By picking the right candidate files you may be able to put the overhead below 10%.&lt;/P&gt;

&lt;P&gt;Another approach is to add HeapValidate function (Windows C Runtime Library function) call at start and end of subroutines and functions.&lt;/P&gt;

&lt;P&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa366708(v=vs.85).aspx"&gt;http://msdn.microsoft.com/en-us/library/windows/desktop/aa366708(v=vs.85).aspx&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Once you locate the subroutine/function you can then enable bounds checking for that file (assuming something wasn't noticed after failure).&lt;/P&gt;

&lt;P&gt;I would set these in as a macro and use the FPP to control if the call is made or a NOOP performed.&lt;/P&gt;

&lt;P&gt;Jim Dempsey&lt;/P&gt;</description>
      <pubDate>Fri, 13 Dec 2013 02:19:37 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Heap-Corruption-on-Deallocate/m-p/937704#M89255</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2013-12-13T02:19:37Z</dc:date>
    </item>
    <item>
      <title>Hi Jim</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Heap-Corruption-on-Deallocate/m-p/937705#M89256</link>
      <description>&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;Hi Jim&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;Adding validation is underway. I am still struggling to find some of the potential issues though. Is there any way to get the name of the array which is corrupted - either by connecting a runtime debugger or a minidump file once an exception has been hit in the runtime?&lt;/P&gt;

&lt;P&gt;All I get right now is something like:&amp;nbsp;&lt;SPAN style="color: rgb(51, 51, 51); font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 12.800000190734863px; line-height: 17.600000381469727px; background-color: rgb(251, 251, 251);"&gt;Unhandled exception at 0x775de753 (ntdll.dll) in hello.exe: 0xC0000374: A heap has been corrupted.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;David&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Dec 2013 03:11:17 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Heap-Corruption-on-Deallocate/m-p/937705#M89256</guid>
      <dc:creator>David2</dc:creator>
      <dc:date>2013-12-13T03:11:17Z</dc:date>
    </item>
    <item>
      <title>You ask "why the subscript</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Heap-Corruption-on-Deallocate/m-p/937706#M89257</link>
      <description>&lt;P&gt;You ask "why the subscript order matters" in terms of the impact of this programming error.&amp;nbsp; If you look at the equivalent one-dimensional indices or offsets into the array for the two cases (i.e the relative address) you will see that the (i, j) form of reference (where j is the index going out of bounds by one) results in a zone of damage that covers the next three elements worth of memory that sit beyond the actual array.&amp;nbsp; The (j,i) case only damages one element worth beyond the end of the array (and two elements inside the array).&lt;/P&gt;

&lt;P&gt;The more area you damage outside the array proper - the more likely you are to see problems such as heap corruption.&lt;/P&gt;

&lt;P&gt;[plain]&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; address:&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp; 2&amp;nbsp;&amp;nbsp; 3&amp;nbsp;&amp;nbsp; 4&amp;nbsp;&amp;nbsp; 5&amp;nbsp;&amp;nbsp; 6&amp;nbsp;&amp;nbsp; 7&amp;nbsp;&amp;nbsp; 8&amp;nbsp;&amp;nbsp; 9&amp;nbsp; 10&amp;nbsp; 11&amp;nbsp; 12&amp;nbsp; 13&lt;BR /&gt;
	array:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 11&amp;nbsp; 21&amp;nbsp; 31&amp;nbsp; 12&amp;nbsp; 22&amp;nbsp; 32&amp;nbsp; 13&amp;nbsp; 23&amp;nbsp; 33&amp;nbsp; x&amp;nbsp;&amp;nbsp; x&amp;nbsp;&amp;nbsp; x&amp;nbsp;&amp;nbsp; x&lt;/P&gt;

&lt;P&gt;&amp;nbsp; &amp;nbsp; (j,i):&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 41&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 42&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 43&lt;BR /&gt;
	(i,j):&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 14&amp;nbsp; 24&amp;nbsp; 34[/plain]&lt;/P&gt;</description>
      <pubDate>Fri, 13 Dec 2013 12:00:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Heap-Corruption-on-Deallocate/m-p/937706#M89257</guid>
      <dc:creator>IanH</dc:creator>
      <dc:date>2013-12-13T12:00:00Z</dc:date>
    </item>
    <item>
      <title>#define CHECK_INDEX1D(A,I) if</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Heap-Corruption-on-Deallocate/m-p/937707#M89258</link>
      <description>&lt;P&gt;#define CHECK_INDEX1D(A,I) if((I.lt.LBOUND(A)).or.(I.gt.UBOUND(A)) call YourTrap(__FILE__,__LINE)&lt;BR /&gt;
	#define CHECK_BOUNDS1D(A,I,J) CHECK_INDEX1D(A,I); CHECK_INDEX1D(A,J)&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Similar thing for 2D, 3D, ...&amp;nbsp;arrays&lt;/P&gt;

&lt;P&gt;subroutine YourTrap(F,L)&lt;BR /&gt;
	character*(*) :: F&lt;BR /&gt;
	integer :: L&lt;BR /&gt;
	! **************** place break point here&lt;BR /&gt;
	write(*,*) "Subscript error. File: ",F," Line: ",L&lt;BR /&gt;
	! return to caller to debug&lt;BR /&gt;
	end subroutine YourTrap&lt;/P&gt;

&lt;P&gt;Then sprinkle the&lt;/P&gt;

&lt;P&gt;CHECK_BOUNDS1D(YourArray, iBegin, iEnd)&lt;BR /&gt;
	DO I=iBegin,iEnd&lt;/P&gt;

&lt;P&gt;In release build, you can define the macro expansion as blank&lt;/P&gt;

&lt;P&gt;Jim Dempsey&lt;/P&gt;</description>
      <pubDate>Fri, 13 Dec 2013 13:18:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Heap-Corruption-on-Deallocate/m-p/937707#M89258</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2013-12-13T13:18:00Z</dc:date>
    </item>
    <item>
      <title>Hi Jim</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Heap-Corruption-on-Deallocate/m-p/937708#M89259</link>
      <description>&lt;P&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;Hi Jim&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;Thanks for the sweet little bounds check! That is really nice and compact and makes it simple to put inside an ifdef for a release build as you point out.&lt;/P&gt;

&lt;P&gt;Thanks -&amp;nbsp;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;David&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Dec 2013 14:29:21 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Heap-Corruption-on-Deallocate/m-p/937708#M89259</guid>
      <dc:creator>David2</dc:creator>
      <dc:date>2013-12-13T14:29:21Z</dc:date>
    </item>
    <item>
      <title>Hi David</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Heap-Corruption-on-Deallocate/m-p/937709#M89260</link>
      <description>&lt;P&gt;Hi David&lt;/P&gt;

&lt;P&gt;Can you post minidump file?&lt;/P&gt;

&lt;P&gt;In order to enable catching heap corruption exception immediately please use Gflags.exe tool.IIRC when page heap option is not enabled Windows will not immediately raise heap corruption exception.&lt;/P&gt;

&lt;P&gt;Web links:&lt;A href="http://msdn.microsoft.com/en-us/library/ff543097.aspx"&gt;http://msdn.microsoft.com/en-us/library/ff543097.aspx&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/windows/hardware/ff542941(v=vs.85).aspx"&gt;http://msdn.microsoft.com/en-us/library/windows/hardware/ff542941(v=vs.85).aspx&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Dec 2013 18:04:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Heap-Corruption-on-Deallocate/m-p/937709#M89260</guid>
      <dc:creator>Bernard</dc:creator>
      <dc:date>2013-12-13T18:04:00Z</dc:date>
    </item>
    <item>
      <title>No tool since Numega's Bounds</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Heap-Corruption-on-Deallocate/m-p/937710#M89261</link>
      <description>&lt;P&gt;No tool since Numega's Bounds Checker of the 1990's can immediately check for out of bounds references (without adversely affecting performance). And that had restrictions. BTW this was before they got bought, pillaged and trashed.&lt;/P&gt;

&lt;P&gt;The DebugHeap will detect heap corruption on malloc/free and explicit calls to HeapValidate. It will not detect when you blast a hole into data outside the range of the array (unless this is outside the mapped area of the VM).&lt;/P&gt;

&lt;P&gt;One of my Fortran projects (solutions) has over 750 files. It is a simulation program and when fully optimized can run 100's of hours (and some times much more). Running in Debug Build with full bounds checking is near impossible (I cannot live that long). The selective use of bounds checking is the only tenable solution (at least for me). The files that you are absolutely certain that have no bounds errors can be compiled with full optimizations. The remaining file can be compiled with bounds checking enabled. At some point in a test run (assuming error not found), you may be able to ascertain that some of the files with bounds checking has checked all permutations of the test data. Then these can be removed from the suspect list. And you compile, and re-run the test. This is a long process.&lt;/P&gt;

&lt;P&gt;Jim Dempsey&lt;/P&gt;</description>
      <pubDate>Fri, 13 Dec 2013 19:12:47 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Heap-Corruption-on-Deallocate/m-p/937710#M89261</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2013-12-13T19:12:47Z</dc:date>
    </item>
    <item>
      <title>Of course exception is thrown</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Heap-Corruption-on-Deallocate/m-p/937711#M89262</link>
      <description>&lt;P&gt;Of course exception is thrown when the user mode code overwrites the specific memory pattern (it has probably &amp;nbsp;this value 0xbadab).Now it will be discovered when the page heap is scanned and its overwritten magic value is compared with the original value.&lt;/P&gt;

&lt;P&gt;Afaik one of the heap managing functions like RtlFreeHeap which is called by free() function will throw an exception when the heap is overwritten or corrupted.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Dec 2013 20:21:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Heap-Corruption-on-Deallocate/m-p/937711#M89262</guid>
      <dc:creator>Bernard</dc:creator>
      <dc:date>2013-12-13T20:21:00Z</dc:date>
    </item>
    <item>
      <title>Hi Ilya, Jim</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Heap-Corruption-on-Deallocate/m-p/937712#M89263</link>
      <description>&lt;P&gt;Hi Ilya, Jim&lt;/P&gt;

&lt;P&gt;Your responses are tremendously helpful. Thank you very much for your time. I have played with GFlags and windbg/ntsd a bit today, but I am having trouble getting it to load symbols properly. Symbols work if i run my exe compiled in debug mode inside ntsd, but I can't seem to get an optimized release mode exe to load symbols for debugging? Is there something I am doing wrong in my project properties?&lt;/P&gt;

&lt;P&gt;Otherwise, between the selective use of compile time bounds checking and the gflags/ntsd options I think I have the tools to solve the problem.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Thanks - David&lt;/P&gt;</description>
      <pubDate>Fri, 13 Dec 2013 22:19:56 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Heap-Corruption-on-Deallocate/m-p/937712#M89263</guid>
      <dc:creator>David2</dc:creator>
      <dc:date>2013-12-13T22:19:56Z</dc:date>
    </item>
    <item>
      <title>A dump file and my compiled</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Heap-Corruption-on-Deallocate/m-p/937713#M89264</link>
      <description>&lt;P&gt;A dump file and my compiled hello.exe are in that attached zip. Let me know if you have better luck loading the symbols than I did.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Dec 2013 22:30:42 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Heap-Corruption-on-Deallocate/m-p/937713#M89264</guid>
      <dc:creator>David2</dc:creator>
      <dc:date>2013-12-13T22:30:42Z</dc:date>
    </item>
    <item>
      <title>David,</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Heap-Corruption-on-Deallocate/m-p/937714#M89265</link>
      <description>&lt;P&gt;David,&lt;/P&gt;

&lt;P&gt;are you trying to load your private symbols or do you have a problem with Microsoft public symbols?&lt;/P&gt;</description>
      <pubDate>Sat, 14 Dec 2013 05:17:08 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Heap-Corruption-on-Deallocate/m-p/937714#M89265</guid>
      <dc:creator>Bernard</dc:creator>
      <dc:date>2013-12-14T05:17:08Z</dc:date>
    </item>
    <item>
      <title>There are two things you need</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Heap-Corruption-on-Deallocate/m-p/937715#M89266</link>
      <description>&lt;P&gt;There are two things you need to check&lt;/P&gt;

&lt;P&gt;1) Make sure the compiler option to produce debug symbols is enabled&lt;BR /&gt;
	2) Make sure the linker option to strip debug symbols is disabled&lt;/P&gt;

&lt;P&gt;Note, a fully optimize program is somewhat hard to debug. In some cases it helps to have&lt;/P&gt;

&lt;P&gt;subroutine InnocuousOutOfLineRoutine()&lt;BR /&gt;
	end subroutine InnocuousOutOfLineRoutine&lt;/P&gt;

&lt;P&gt;Compile as a separate file to .obj without optimizations.&lt;BR /&gt;
	Keep the .obj, delete the source (IPO may find it)&lt;/P&gt;

&lt;P&gt;Include the InnocuousOutOfLineRoutine.obj in the project&lt;BR /&gt;
	Sprinkle the calls to the subroutine in places that are difficult to debug.&lt;/P&gt;

&lt;P&gt;The line number of the CALL InnocuousOutOfLineRoutine() should be in sync with the debug session.&lt;/P&gt;

&lt;P&gt;If you do not remove the source to InnocuousOutOfLineRoutine, and have IPO enabled, it then may inline the subroutine and then remove it.&lt;/P&gt;

&lt;P&gt;Jim Dempsey&lt;/P&gt;</description>
      <pubDate>Sat, 14 Dec 2013 14:10:09 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Heap-Corruption-on-Deallocate/m-p/937715#M89266</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2013-12-14T14:10:09Z</dc:date>
    </item>
    <item>
      <title>Hi David</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Heap-Corruption-on-Deallocate/m-p/937716#M89267</link>
      <description>&lt;P&gt;Hi David&lt;/P&gt;

&lt;P&gt;I loaded provided by you minidump file and I did not have any problems with loading&amp;nbsp;Microsoft public symbols.I quickly looked at call stack dump and I saw that heap corruption was signaled/detected probably by&amp;nbsp;&amp;nbsp;RtlpCoalesceFreeBlocks+0x84c function operating from kernel mode.This function was called by Win API HeapFree().Tomorrow I will post more detailed analysis.By the way I do not use ntsd.You can do everything from withing Gui version of windbg.&lt;/P&gt;

&lt;P&gt;In case that you did not properly set your symbol path,below I pasted the proper version of the symbol path&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;SRV*c:\symbols*http://msdl.microsoft.com/download/symbols&lt;/STRONG&gt;&lt;SPAN style="font-size: 1em; line-height: 1.5;"&gt;*&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 14 Dec 2013 17:40:35 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Heap-Corruption-on-Deallocate/m-p/937716#M89267</guid>
      <dc:creator>Bernard</dc:creator>
      <dc:date>2013-12-14T17:40:35Z</dc:date>
    </item>
    <item>
      <title>&gt;&gt;&gt;SRV*c:\symbols*http://msdl</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Heap-Corruption-on-Deallocate/m-p/937717#M89268</link>
      <description>&lt;P&gt;&lt;SPAN style="font-weight: 700; font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 14.399999618530273px;"&gt;&amp;gt;&amp;gt;&amp;gt;SRV*c:\symbols*&lt;A href="http://msdl.microsoft.com/download/symbols" style="font-weight: normal;"&gt;http://msdl.microsoft.com/download/symbols&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 14.399999618530273px;"&gt;*&amp;gt;&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; line-height: 14.399999618530273px;"&gt;Of course instead of c:\symbols create your own directory.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 15 Dec 2013 13:20:14 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Heap-Corruption-on-Deallocate/m-p/937717#M89268</guid>
      <dc:creator>Bernard</dc:creator>
      <dc:date>2013-12-15T13:20:14Z</dc:date>
    </item>
  </channel>
</rss>

