<?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 Segfault without debug options in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Segfault-without-debug-options/m-p/744087#M2653</link>
    <description>&lt;P&gt;Correct. It crashes when it tries to search for the first point for the first time, unless run with -g or -C.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Tim&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 09 Feb 2010 17:08:22 GMT</pubDate>
    <dc:creator>Tim_Gallagher</dc:creator>
    <dc:date>2010-02-09T17:08:22Z</dc:date>
    <item>
      <title>Segfault without debug options</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Segfault-without-debug-options/m-p/744080#M2646</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;I have a code that interpolates a dataset from one grid onto another. However, it shows some strange behavior when compiled with an Intel compiler (this works without problem on IBM). When run with no compiler options (so defaulting to -O2), it segfaults. Turning on -traceback will show the line where it crashes, but it still crashes. However, when -g is enabled, it no longer crashes and runs just fine (albeit slow).&lt;/P&gt;

&lt;P&gt;I tried a few different combinations:&lt;/P&gt;

&lt;P&gt;-g -O2: Crash in the same place&lt;/P&gt;

&lt;P&gt;-O0: Crash in the same place&lt;/P&gt;

&lt;P&gt;-O2 -fno-omit-frame-pointer: Crash in the same place&lt;/P&gt;

&lt;P&gt;Attached is a sample dataset and the code. The shell script, gridInterp.sh, will compile the executable if it doesn't already exist, change the stack limit of the terminal, and then run the code. So, you would have to remove the executable if you change options and need it to recompile.&lt;/P&gt;

&lt;P&gt;The inputs are (in order): 1, 27, 500, -3, 4, 5.&lt;/P&gt;

&lt;P&gt;If anybody has any insight into why -g makes the code runnable, I'd appeciate it. Thanks,&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Tim&lt;/P&gt;</description>
      <pubDate>Mon, 08 Feb 2010 17:17:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Segfault-without-debug-options/m-p/744080#M2646</guid>
      <dc:creator>Tim_Gallagher</dc:creator>
      <dc:date>2010-02-08T17:17:00Z</dc:date>
    </item>
    <item>
      <title>Segfault without debug options</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Segfault-without-debug-options/m-p/744081#M2647</link>
      <description>&lt;P&gt;Have you checked into the diagnostic messages?&lt;/P&gt;
&lt;P&gt;grid_interp.f90(104): error #12306: unvalidated value is received from call to&lt;BR /&gt;n external function at (file:grid_interp.f90 line:47) which can be used in loop&lt;BR /&gt;condition expression&lt;BR /&gt;grid_interp.f90(104): error #12306: unvalidated value is received from call to&lt;BR /&gt;n external function at (file:grid_interp.f90 line:88) which can be used in loop&lt;BR /&gt;condition expression&lt;BR /&gt;grid_interp.f90(107): error #12306: unvalidated value is received from call to&lt;BR /&gt;n external function at (file:grid_interp.f90 line:88) which can be used in loop&lt;BR /&gt;condition expression&lt;BR /&gt;grid_interp.f90(238): error #12306: unvalidated value is received from call to&lt;BR /&gt;n external function at (file:grid_interp.f90 line:221) which can be used in loo&lt;BR /&gt; condition expression&lt;BR /&gt;grid_interp.f90(241): error #12306: unvalidated value is received from call to&lt;BR /&gt;n external function at (file:grid_interp.f90 line:221) which can be used in loo&lt;BR /&gt; condition expression&lt;BR /&gt;grid_interp.f90(270): error #12306: unvalidated value is received from call to&lt;BR /&gt;n external function at (file:grid_interp.f90 line:53) which can be used in loop&lt;BR /&gt;condition expression&lt;BR /&gt;grid_interp.f90(294): error #12145: function "GI_SEARCHTREE" is called as subro&lt;BR /&gt;tine&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;If you do in fact mix function and subroutine call of the same name, you may get a data over-run which might accidentally be OK when there is more symbol information spacing out the more critical data.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Feb 2010 19:45:11 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Segfault-without-debug-options/m-p/744081#M2647</guid>
      <dc:creator>TimP</dc:creator>
      <dc:date>2010-02-08T19:45:11Z</dc:date>
    </item>
    <item>
      <title>Segfault without debug options</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Segfault-without-debug-options/m-p/744082#M2648</link>
      <description>&lt;P&gt;Thanks for looking at it. How did you generate those diagnostic messages?&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;The first batch about the unvalidated value -- those are user input or read from a file. I'm not sure what the compiler means there, but the numbers read in are okay for loop variables (unless somebody types in junk).&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;The last one, about the function called as a subroutine I am really confused about. The line in question is:&lt;/P&gt;
&lt;P&gt;currentNode =&amp;gt; GI_SearchTree(currentNode, pX, pY, pZ)&lt;/P&gt;
&lt;P&gt;where&lt;/P&gt;
&lt;P&gt;FUNCTION GI_SearchTree(startNode, X, Y, Z) RESULT(contNode)&lt;BR /&gt; USE TREE&lt;BR /&gt;&lt;BR /&gt; IMPLICIT NONE&lt;BR /&gt;&lt;BR /&gt; TYPE(NODE), POINTER :: contNode, startNode&lt;BR /&gt; REAL*8, INTENT(IN) :: X, Y, Z&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;And there is no place that GI_SearchTree is declared as a SUBROUTINE, nor do I CALL it.&lt;/P&gt;
&lt;P&gt;Any ideas?&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Tim&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Feb 2010 19:54:46 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Segfault-without-debug-options/m-p/744082#M2648</guid>
      <dc:creator>Tim_Gallagher</dc:creator>
      <dc:date>2010-02-08T19:54:46Z</dc:date>
    </item>
    <item>
      <title>Segfault without debug options</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Segfault-without-debug-options/m-p/744083#M2649</link>
      <description>Tim used the Source Checker option (-diag-enable sc). Unfortunately, it tends to get very confused by Fortran code (it's better with C/C++.) I like to try it when I can't otherwise understand a behavior, but it's more often than not less than helpful. I suspect that in this case it doesn't understand the way the Fortran compiler implements functions returning pointers, since to the optimzer it "looks like" a subroutine call with the function return variable a hidden argument.&lt;BR /&gt;</description>
      <pubDate>Mon, 08 Feb 2010 19:57:48 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Segfault-without-debug-options/m-p/744083#M2649</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2010-02-08T19:57:48Z</dc:date>
    </item>
    <item>
      <title>Segfault without debug options</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Segfault-without-debug-options/m-p/744084#M2650</link>
      <description>&lt;P&gt;I suppose the warnings are simply warnings, indicating that the program is vulnerable to bad input.&lt;/P&gt;
&lt;P&gt;If there is not actually a mixture of subroutine and function calling, then there is a bug in the compiler diagnostics invoked by 'ifort -diag-enable sc'. I have seen this before; I would certainly like to see it fixed, so as to avoid doubts about whether the compiler is working correctly on the example.&lt;/P&gt;
&lt;P&gt;It's also valuable to run a build made with -check enabled, if you haven't done so.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Feb 2010 20:02:31 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Segfault-without-debug-options/m-p/744084#M2650</guid>
      <dc:creator>TimP</dc:creator>
      <dc:date>2010-02-08T20:02:31Z</dc:date>
    </item>
    <item>
      <title>Segfault without debug options</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Segfault-without-debug-options/m-p/744085#M2651</link>
      <description>&lt;P&gt;It's been awhile since I've run with -check on this code, but I just did it again and it runs to completion with no crash, which is the same as when run with -g.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Tim&lt;/P&gt;</description>
      <pubDate>Mon, 08 Feb 2010 20:06:04 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Segfault-without-debug-options/m-p/744085#M2651</guid>
      <dc:creator>Tim_Gallagher</dc:creator>
      <dc:date>2010-02-08T20:06:04Z</dc:date>
    </item>
    <item>
      <title>Segfault without debug options</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Segfault-without-debug-options/m-p/744086#M2652</link>
      <description>&lt;P&gt;this is what I see, is this what you see when you run it also?&lt;/P&gt;
&lt;P&gt;$ ./gi.x&lt;BR /&gt; Enter the number of blocks in the old grid...&lt;BR /&gt;1&lt;BR /&gt; Enter the number of blocks in the new grid...&lt;BR /&gt;27&lt;BR /&gt; Enter the maximum number of grid points for each node...&lt;BR /&gt;500&lt;BR /&gt; Enter NLG...&lt;BR /&gt;-3&lt;BR /&gt; Enter NRG...&lt;BR /&gt;4&lt;BR /&gt; Enter the number of variables in the restart file...&lt;BR /&gt;5&lt;BR /&gt; Reading the old grid...&lt;BR /&gt; DOM: 1 IMAX = 129 JMAX = 129 KMAX = 129&lt;BR /&gt; There are 2097152 grid points in the old grid&lt;BR /&gt; Must allocate 4194306 data spots&lt;BR /&gt; Attaching data to the root&lt;BR /&gt; Minimum coordinates are: -4.762500000000000E-003 -4.762500000000000E-003&lt;BR /&gt; -4.762500000000000E-003&lt;BR /&gt; Maximum coordinates are: 0.157162500000000 0.157162500000000 &lt;BR /&gt; 0.157162500000000 &lt;BR /&gt; Attached minimum coordinate data at 1&lt;BR /&gt; Attached maximum coordinate data at 2&lt;BR /&gt; FINISHED WITH BLOCK 1&lt;BR /&gt; Building tree from the dataset&lt;BR /&gt; Done building tree&lt;BR /&gt; Reading new grid...&lt;BR /&gt; DOM = 1 IMAX = 129 JMAX = 11 KMAX = 12&lt;BR /&gt; DOM = 2 IMAX = 129 JMAX = 11 KMAX = 12&lt;BR /&gt; DOM = 3 IMAX = 129 JMAX = 11 KMAX = 13&lt;BR /&gt; DOM = 4 IMAX = 129 JMAX = 11 KMAX = 12&lt;BR /&gt; DOM = 5 IMAX = 129 JMAX = 11 KMAX = 12&lt;BR /&gt; DOM = 6 IMAX = 129 JMAX = 11 KMAX = 13&lt;BR /&gt; DOM = 7 IMAX = 129 JMAX = 11 KMAX = 12&lt;BR /&gt; DOM = 8 IMAX = 129 JMAX = 11 KMAX = 12&lt;BR /&gt; DOM = 9 IMAX = 129 JMAX = 11 KMAX = 13&lt;BR /&gt; DOM = 10 IMAX = 129 JMAX = 21 KMAX = 12&lt;BR /&gt; DOM = 11 IMAX = 129 JMAX = 11 KMAX = 12&lt;BR /&gt; DOM = 12 IMAX = 129 JMAX = 21 KMAX = 12&lt;BR /&gt; DOM = 13 IMAX = 129 JMAX = 11 KMAX = 12&lt;BR /&gt; DOM = 14 IMAX = 129 JMAX = 21 KMAX = 13&lt;BR /&gt; DOM = 15 IMAX = 129 JMAX = 11 KMAX = 13&lt;BR /&gt; DOM = 16 IMAX = 129 JMAX = 14 KMAX = 12&lt;BR /&gt; DOM = 17 IMAX = 129 JMAX = 12 KMAX = 12&lt;BR /&gt; DOM = 18 IMAX = 129 JMAX = 14 KMAX = 12&lt;BR /&gt; DOM = 19 IMAX = 129 JMAX = 12 KMAX = 12&lt;BR /&gt; DOM = 20 IMAX = 129 JMAX = 14 KMAX = 13&lt;BR /&gt; DOM = 21 IMAX = 129 JMAX = 12 KMAX = 13&lt;BR /&gt; DOM = 22 IMAX = 129 JMAX = 12 KMAX = 12&lt;BR /&gt; DOM = 23 IMAX = 129 JMAX = 14 KMAX = 12&lt;BR /&gt; DOM = 24 IMAX = 129 JMAX = 12 KMAX = 12&lt;BR /&gt; DOM = 25 IMAX = 129 JMAX = 14 KMAX = 12&lt;BR /&gt; DOM = 26 IMAX = 129 JMAX = 12 KMAX = 13&lt;BR /&gt; DOM = 27 IMAX = 129 JMAX = 14 KMAX = 13&lt;BR /&gt; Reading the old restart file...&lt;BR /&gt; Searching for nearest points and interpolating&lt;BR /&gt; Starting search and interpolation for new block 1&lt;BR /&gt;forrtl: severe (174): SIGSEGV, segmentation fault occurred&lt;BR /&gt;Image PC Routine Line Source &lt;BR /&gt;gi.x 000000000040A859 gi_data_mp_gi_sea 274 gi_data_mod.f90&lt;BR /&gt;gi.x 00000000004126F5 MAIN__ 294 grid_interp.f90&lt;BR /&gt;gi.x 0000000000402B1C Unknown Unknown Unknown&lt;BR /&gt;libc.so.6 0000003D0FC1D8A4 Unknown Unknown Unknown&lt;BR /&gt;gi.x 0000000000402A29 Unknown Unknown Unknown&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Feb 2010 17:02:49 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Segfault-without-debug-options/m-p/744086#M2652</guid>
      <dc:creator>Ron_Green</dc:creator>
      <dc:date>2010-02-09T17:02:49Z</dc:date>
    </item>
    <item>
      <title>Segfault without debug options</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Segfault-without-debug-options/m-p/744087#M2653</link>
      <description>&lt;P&gt;Correct. It crashes when it tries to search for the first point for the first time, unless run with -g or -C.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Tim&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Feb 2010 17:08:22 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Segfault-without-debug-options/m-p/744087#M2653</guid>
      <dc:creator>Tim_Gallagher</dc:creator>
      <dc:date>2010-02-09T17:08:22Z</dc:date>
    </item>
    <item>
      <title>Segfault without debug options</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Segfault-without-debug-options/m-p/744088#M2654</link>
      <description>&lt;P&gt;Tim,&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;I'm still narrowing this down, but it's definitely a compiler bug (no surprise, huh?). AND it only appears in 11.1.046 and newer compilers. If you use any compiler older than this it will run fine.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;I've narrowed it down to tree_mod.f90. If you compile this with:&lt;/P&gt;
&lt;P&gt;-no-vec&lt;/P&gt;
&lt;P&gt;and compile everything else at -O2 and link, it'll run fast and fine.&lt;/P&gt;
&lt;P&gt;I believe the compiler is getting overly agressive with tree_mod.f90 lines 286, 306, and 338. It seems to be vectorizing the NULLIFY statements in here, which it shouldn't because there is a dependency with the temp pointer assignment prior to each nullify. I am not sure if the nullify near line 475 is also being munged.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;After I narrow this down a bit more I'll get a bug report started.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;ron&lt;/P&gt;</description>
      <pubDate>Tue, 09 Feb 2010 18:22:01 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Segfault-without-debug-options/m-p/744088#M2654</guid>
      <dc:creator>Ron_Green</dc:creator>
      <dc:date>2010-02-09T18:22:01Z</dc:date>
    </item>
    <item>
      <title>Segfault without debug options</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Segfault-without-debug-options/m-p/744089#M2655</link>
      <description>&lt;P&gt;Thanks! Sorry I seem to find bugs a lot... I don't know how I keep coming up with strange/obscure programs.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Compiling tree_mod with -no-vec worked just fine as you suggested.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;On a whim, I tried putting !DEC$ NOVECTOR in front of the three loops you mentioned and I compiled and ran it with -O2 on tree_mod.f90. It still crashes. Using -vec-report3, it doesn't vectorize line 475 because it assumes a vector dependence, and it didn't vectorize the three loops with NOVECTOR.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;So I guess there's still something else going on somewhere. But you already knew that!&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Thanks again,&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Tim&lt;/P&gt;</description>
      <pubDate>Tue, 09 Feb 2010 18:44:35 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Segfault-without-debug-options/m-p/744089#M2655</guid>
      <dc:creator>Tim_Gallagher</dc:creator>
      <dc:date>2010-02-09T18:44:35Z</dc:date>
    </item>
    <item>
      <title>Segfault without debug options</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Segfault-without-debug-options/m-p/744090#M2656</link>
      <description>&lt;P&gt;DEC$ NOVECTOR - yes, I found that earlier this morning too. I'm going to have to dig in further to see what's going on with the optimization of these loops. There must be some loop transformations going on that is violating the ordering of the statements in the loop. Often the optimizer will do some loop transforms in order to get a non-vectorized loop to vectorize. I'm also not discounting the possibility that the NULLIFY library call itself may be at fault.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;ron&lt;/P&gt;</description>
      <pubDate>Tue, 09 Feb 2010 19:34:11 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Segfault-without-debug-options/m-p/744090#M2656</guid>
      <dc:creator>Ron_Green</dc:creator>
      <dc:date>2010-02-09T19:34:11Z</dc:date>
    </item>
    <item>
      <title>Segfault without debug options</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Segfault-without-debug-options/m-p/744091#M2657</link>
      <description>&lt;P&gt;bug report is DPD200150928&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;ron&lt;/P&gt;</description>
      <pubDate>Mon, 22 Feb 2010 22:11:53 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Segfault-without-debug-options/m-p/744091#M2657</guid>
      <dc:creator>Ron_Green</dc:creator>
      <dc:date>2010-02-22T22:11:53Z</dc:date>
    </item>
  </channel>
</rss>

