<?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: Suspected optimizer bug in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Suspected-optimizer-bug/m-p/1475933#M166032</link>
    <description>&lt;P&gt;In Fortran 77, given the limitations of the DATA statement, the use of a saved logical or integer variable to control an IF..ENDIF block was a standard (the only?) way to initialize a variable with the value of an expression with an exact and unchanging value and avoid calculating that expression more than once. Here is an example that you are likely to find even in modern codes (F95, F2003, etc.)&lt;/P&gt;
&lt;LI-CODE lang="fortran"&gt;logical, save :: begin = .true.
double precision, save :: pi
..
if(begin)then
   begin = .false.
   pi = 4d0*atan(1d0)
endif
&lt;/LI-CODE&gt;
&lt;P&gt;More recent revisions of the Fortran standard have allowed more intrinsic functions to be used in initialization expressions, so you are now allowed to write&lt;/P&gt;
&lt;LI-CODE lang="fortran"&gt;double precision, save :: pi = 4d0*atan(1d0)&lt;/LI-CODE&gt;
&lt;P&gt;There are also newer intrinsic modules that provide definitions for constants such as &lt;STRONG&gt;&lt;SPAN class="texhtml mvar"&gt;π&lt;/SPAN&gt;&lt;/STRONG&gt;, so all that is needed is a USE statement.&lt;/P&gt;</description>
    <pubDate>Wed, 12 Apr 2023 18:10:37 GMT</pubDate>
    <dc:creator>mecej4</dc:creator>
    <dc:date>2023-04-12T18:10:37Z</dc:date>
    <item>
      <title>Suspected optimizer bug</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Suspected-optimizer-bug/m-p/1475120#M165991</link>
      <description>&lt;P&gt;Here is a very short program that uses two routines from Lapack:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="fortran"&gt;program tdlamc2
   implicit none
   integer beta, it, imin, imax, irnd
   double precision eps, rmin, rmax
   logical lrnd

   call dlamc2( beta, it, lrnd, eps, imin, rmin, imax, rmax )
   if( lrnd ) then
      irnd = 1
      eps = ( beta**( 1d0-it ) ) / 2
   else
      irnd = 0
      eps = beta**( 1d0-it )
   end if
   print 77, beta,it,irnd,imin,imax
77 format('base,it,irnd,  imin,imax: ',5I8)
   print 78,eps,rmin,rmax
78 format('eps,rmin,rmax: ',3ES20.12)
end program&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The two&amp;nbsp; Lapack files needed are: &lt;A href="https://netlib.org/lapack/explore-html/d8/d32/dlamchf77_8f_source.html" target="_self"&gt;dlamch.f&lt;/A&gt; and &lt;A href="https://netlib.org/lapack/explore-html/d8/d32/dlamchf77_8f_source.html" target="_self"&gt;lsame.f&lt;/A&gt;&amp;nbsp; . Building and running with optimization disabled produces the correct result (with ifx as well as ifort):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;ifx /MD /Od /traceback tdlamc2.f90 dlamch.f lsame.f
&amp;gt;tdlamc2
base,it,irnd,  imin,imax:        2      53       1   -1021    1024
eps,rmin,rmax:   1.110223024625E-16  2.225073858507-308  1.797693134862+308&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Changing the optimization level to /O2 produces EXEs that hang (with ifx as well as ifort).&lt;/P&gt;
&lt;P&gt;I used the recently released version of the compiler (20230320) on Windows 11 64-bit.&lt;/P&gt;
&lt;P&gt;[NOTE: The routine DLAMC2 is available in MKL, but using that gives incorrect results, as I have reported in a separate post on the MKL forum.]&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2023 00:01:13 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Suspected-optimizer-bug/m-p/1475120#M165991</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2023-04-11T00:01:13Z</dc:date>
    </item>
    <item>
      <title>Re: Suspected optimizer bug</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Suspected-optimizer-bug/m-p/1475370#M166000</link>
      <description>&lt;P&gt;add&lt;/P&gt;
&lt;P&gt;/warn:interfaces&amp;nbsp; /standard-semantics /fp-model:precise&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and try again.&amp;nbsp; Also, so I don't have to waste 10 minutes finding dlamch.f and lsame.f, if the above does not help please attach those 2 source files.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2023 15:06:50 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Suspected-optimizer-bug/m-p/1475370#M166000</guid>
      <dc:creator>Ron_Green</dc:creator>
      <dc:date>2023-04-11T15:06:50Z</dc:date>
    </item>
    <item>
      <title>Re: Suspected optimizer bug</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Suspected-optimizer-bug/m-p/1475386#M166001</link>
      <description>&lt;P&gt;I provided links to the two Netlib source files concerned (need to copy/paste, but that is how they provide the Lapack sources of individual routines), and I have attached a Zip file containing all three files below.&lt;/P&gt;
&lt;P&gt;The bug (program hangs) does not occur if the /fp:precise option is used. Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2023 15:39:59 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Suspected-optimizer-bug/m-p/1475386#M166001</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2023-04-11T15:39:59Z</dc:date>
    </item>
    <item>
      <title>Re: Suspected optimizer bug</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Suspected-optimizer-bug/m-p/1475394#M166002</link>
      <description>&lt;P&gt;&lt;a href="https://community.intel.com/t5/user/viewprofilepage/user-id/41971"&gt;@mecej4&lt;/a&gt;&amp;nbsp;I apologize, I didn't read your first post carefully.&amp;nbsp; I'll try to unpeel the PRECISE options to find the specific options needed.&amp;nbsp; I suspect flush to zero, maybe precise-divide.&amp;nbsp; Usually one of those 2.&amp;nbsp; NO-FTZ if denormals are needed to converge.&amp;nbsp; precise divide because non-precise is sloppy IMHO.&amp;nbsp; &amp;nbsp;Just my first 2 guesses.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2023 15:47:01 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Suspected-optimizer-bug/m-p/1475394#M166002</guid>
      <dc:creator>Ron_Green</dc:creator>
      <dc:date>2023-04-11T15:47:01Z</dc:date>
    </item>
    <item>
      <title>Re: Suspected optimizer bug</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Suspected-optimizer-bug/m-p/1475403#M166003</link>
      <description>&lt;P&gt;The plot thickens - I didn't expect floating overflow.&amp;nbsp; Yes, this is going to need a deeper look.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;$ ifort -g -O2 -xhost -fpe0 -traceback tdlamc2.f90 dlamchf77.f lsame.f -o tdlamc2&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;rwgreen@orcsle153:~/quad/tnew$ ./tdlamc2&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;forrtl: error (72): floating overflow&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;Image&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;PC&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;Routine&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;Line&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;Source&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;libc.so.6&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;00007F6CFB23EA30&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;Unknown &lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;Unknown&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;Unknown&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;tdlamc2&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;0000000000404870&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;dlamc2_ &lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;329&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;dlamchf77.f&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;tdlamc2&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;0000000000404258&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;MAIN__&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;7&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;tdlamc2.f90&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;tdlamc2&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;00000000004041BD&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;Unknown &lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;Unknown&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;Unknown&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;libc.so.6&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;00007F6CFB229510&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;Unknown &lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;Unknown&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;Unknown&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;libc.so.6&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;00007F6CFB2295C9&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;__libc_start_main &lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;Unknown&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;Unknown&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;tdlamc2&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;00000000004040D5&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;Unknown &lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;Unknown&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &lt;/SPAN&gt;Unknown&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;Aborted (core dumped)&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2023 16:07:04 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Suspected-optimizer-bug/m-p/1475403#M166003</guid>
      <dc:creator>Ron_Green</dc:creator>
      <dc:date>2023-04-11T16:07:04Z</dc:date>
    </item>
    <item>
      <title>Re: Suspected optimizer bug</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Suspected-optimizer-bug/m-p/1475404#M166004</link>
      <description>&lt;P&gt;No problem Ron, and I wish to point out that the reason that I chose to report the issue as a suspected optimizer bug is that it took a considerable effort to isolate the cause of the program hangs. &lt;/P&gt;
&lt;P&gt;The actual code where the issue occurred is a numerical nonlinear optimization program with about 18,000 lines of code plus Lapack and BLAS. I tried other compilers, and there were no hangs, but their runs were rather slow (about 30 seconds instead of less than 10 seconds with Ifort when it did not cause a program hang). One expects the possibility of incorrect/inaccurate results when optimization options are on, but hangs are tough to overcome -- no hang occurred if /Zi or /Zd options were used in an attempt to narrow down the area of code causing the hang.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2023 16:12:16 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Suspected-optimizer-bug/m-p/1475404#M166004</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2023-04-11T16:12:16Z</dc:date>
    </item>
    <item>
      <title>Re: Suspected optimizer bug</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Suspected-optimizer-bug/m-p/1475414#M166005</link>
      <description>&lt;P&gt;OK, so you can use&lt;/P&gt;
&lt;P&gt;-fp-model source&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;along with optimizations.&amp;nbsp; I would not call this an optimizer bug.&amp;nbsp; Rather, looks like a recurring issue we see with legacy code.&amp;nbsp; This loop, see what you think:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="fortran"&gt;326 *+       WHILE( C.EQ.ONE )LOOP
327    30    CONTINUE
328          IF( c.EQ.one ) THEN
329             lt = lt + 1
330             a = a*lbeta
331             c = dlamc3( a, one )
332             c = dlamc3( c, -a )
333             GO TO 30
334          END IF
335 *+       END WHILE
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think you may see the problem with comparing C to ONE with .EQ..&amp;nbsp; Probably should be a check if they are close near epsilon.&amp;nbsp; Also the initializations of these double precision vars.&amp;nbsp; Right above this loop, look how REAL(8) C, A, LT are initialized:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;322          lt = 0
323          a = 1
324          c = 1
325 *        
326 *+       WHILE( C.EQ.ONE )LOOP
327    30    CONTINUE
328          IF( c.EQ.one ) THEN
329             lt = lt + 1
330             a = a*lbeta
331             c = dlamc3( a, one )
332             c = dlamc3( c, -a )
333             GO TO 30
334          END IF
335 *+       END WHILE
&lt;/LI-CODE&gt;
&lt;P&gt;You can backtrace ONE to see it's initialization also.&amp;nbsp; a = 1 as an example:&amp;nbsp;&lt;BR /&gt;With -fpe0 I saw LT overflow.&amp;nbsp; obviously the c.eq.one never happened, hence the "hang"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think the -fp-model source is a good fix without rewriting this routine to be numerically safe to modern standards.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2023 16:31:52 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Suspected-optimizer-bug/m-p/1475414#M166005</guid>
      <dc:creator>Ron_Green</dc:creator>
      <dc:date>2023-04-11T16:31:52Z</dc:date>
    </item>
    <item>
      <title>Re: Suspected optimizer bug</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Suspected-optimizer-bug/m-p/1475421#M166006</link>
      <description>&lt;P&gt;The line number reported as the location of the FP overflow is not plausible, since the code on line 330 just increments an integer variable, "lt".&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2023 16:42:55 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Suspected-optimizer-bug/m-p/1475421#M166006</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2023-04-11T16:42:55Z</dc:date>
    </item>
    <item>
      <title>Re: Suspected optimizer bug</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Suspected-optimizer-bug/m-p/1475424#M166007</link>
      <description>&lt;P&gt;&lt;a href="https://community.intel.com/t5/user/viewprofilepage/user-id/40347"&gt;@Ron&lt;/a&gt; wrote:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; obviously the c.eq.one never happened, hence the "hang"&lt;/P&gt;
&lt;P&gt;??? From the Fortran code, I have to conclude that the double precision variable C was initialized to 1.0D0. For the loop to run for ever, C would have to stay unchanged, at 1.0D0, i.e. c.eq.one remained .TRUE. all the time.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2023 16:51:43 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Suspected-optimizer-bug/m-p/1475424#M166007</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2023-04-11T16:51:43Z</dc:date>
    </item>
    <item>
      <title>Re: Suspected optimizer bug</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Suspected-optimizer-bug/m-p/1475430#M166008</link>
      <description>&lt;P&gt;Ah, another mistake on my part.&amp;nbsp; I'll revisit this later in the week when I have less interrupts.&amp;nbsp; For now -fp-model precise or source is a reasonable work around.&amp;nbsp; I'll need time to try gfortran with max optimizations and see what it does with this code.&amp;nbsp; Maybe something in our optimizer.&amp;nbsp; Maybe.&amp;nbsp; just may be overly aggressive.&amp;nbsp; I can try some older iforts as well.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2023 17:00:07 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Suspected-optimizer-bug/m-p/1475430#M166008</guid>
      <dc:creator>Ron_Green</dc:creator>
      <dc:date>2023-04-11T17:00:07Z</dc:date>
    </item>
    <item>
      <title>Re: Suspected optimizer bug</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Suspected-optimizer-bug/m-p/1475437#M166009</link>
      <description>&lt;P&gt;With the original code (using WHILE), compiled with optimizations .and. debug info...&lt;/P&gt;
&lt;P&gt;When the loop hangs, issue a Pause (break into the program).&lt;/P&gt;
&lt;P&gt;Then open a disassembly window, focus to that window, and step through the loop.&lt;/P&gt;
&lt;P&gt;This should expose the issue as to if it is within function dlamc3 or if the C in the WHILE test is different from the C=.&lt;/P&gt;
&lt;P&gt;Now I know the source code shows that they ought to be the same, but we are looking for (eliminating) potential optimization bug.&lt;/P&gt;
&lt;P&gt;Jim Dempsey&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2023 17:12:55 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Suspected-optimizer-bug/m-p/1475437#M166009</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2023-04-11T17:12:55Z</dc:date>
    </item>
    <item>
      <title>Re: Suspected optimizer bug</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Suspected-optimizer-bug/m-p/1475438#M166010</link>
      <description>&lt;P&gt;Interesting , gfortran with -ffast-math also hangs&lt;/P&gt;
&lt;LI-CODE lang="none"&gt;gfortran -O2 tdlamc2.f90 dlamchf77.f lsame.f -o tdlamc2 -ffast-math
~/quad/tnew$ ./tdlamc2
^C
~/quad/tnew$ gfortran --version
GNU Fortran (GCC) 12.0.1 20220413 (Red Hat 12.0.1-0)
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 11 Apr 2023 17:16:18 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Suspected-optimizer-bug/m-p/1475438#M166010</guid>
      <dc:creator>Ron_Green</dc:creator>
      <dc:date>2023-04-11T17:16:18Z</dc:date>
    </item>
    <item>
      <title>Re: Suspected optimizer bug</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Suspected-optimizer-bug/m-p/1475442#M166011</link>
      <description>&lt;P&gt;FMA is at play here as well, at least for the hang.&amp;nbsp; Note that RMAX is infinity however.&amp;nbsp; So other things at play in the optimizations.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;ifort -g -O2 -xhost -traceback tdlamc2.f90 dlamchf77.f lsame.f -o tdlamc2 -no-fma
rwgreen@orcsle153:~/quad/tnew$ ./tdlamc2 
base,it,irnd,  imin,imax:        2      53       0   -1021    1025
eps,rmin,rmax:   2.220446049250E-16  2.225073858507-308            Infinity
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2023 17:27:31 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Suspected-optimizer-bug/m-p/1475442#M166011</guid>
      <dc:creator>Ron_Green</dc:creator>
      <dc:date>2023-04-11T17:27:31Z</dc:date>
    </item>
    <item>
      <title>Re: Suspected optimizer bug</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Suspected-optimizer-bug/m-p/1475501#M166015</link>
      <description>&lt;P&gt;&lt;a href="https://community.intel.com/t5/user/viewprofilepage/user-id/52256"&gt;@Ron_Green&lt;/a&gt;, it's my turn to apologize! While searching for more information about DLAMCH and its siblings, I found the following warning in the &lt;A href="https://netlib.org/lapack/faq.html" target="_self"&gt;Lapack FAQ&lt;/A&gt;:&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;The routine dlamch.f (and its dependent subroutines dlamc1, dlamc2, dlamc3, dlamc4, dlamc5) MUST be compiled without optimization. If you downloaded the entire lapack distribution this will be taken care of by the LAPACK/SRC/Makefile. However, if you downloaded a specific LAPACK routine plus dependencies, you need to take care that slamch.f (if you downloaded a single precision real or single precision complex routine) or dlamch.f (if you downloaded a double precision real or double precision complex routine) has been included.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;Perhaps this is the same caution that, not having been placed in the source file in plain sight, was not recognized when MKL was built, and that lapse caused the DLAMCH in MKL to give incorrect results. My attempt to mend matters by downloading individual Lapack source files and compiling them with optimizations turned on probably made things worse.&lt;/P&gt;
&lt;P&gt;I did file a bug report in the MKL forum, before I started this thread, but it has not been answered yet. Some coordination between the Intel compiler and MKL teams seems to be required to make the necessary corrections to the DLAMCH within MKL.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2023 19:40:04 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Suspected-optimizer-bug/m-p/1475501#M166015</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2023-04-11T19:40:04Z</dc:date>
    </item>
    <item>
      <title>Re: Suspected optimizer bug</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Suspected-optimizer-bug/m-p/1475514#M166016</link>
      <description>&lt;P&gt;Like you, it would not occur to me to check the LAPACK faqs.&amp;nbsp; Indeed that should be in the source header.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I will check in with a colleague on MKL to follow up on your post.&amp;nbsp; Their forum is not as well monitored as ours.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2023 19:53:34 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Suspected-optimizer-bug/m-p/1475514#M166016</guid>
      <dc:creator>Ron_Green</dc:creator>
      <dc:date>2023-04-11T19:53:34Z</dc:date>
    </item>
    <item>
      <title>Re: Suspected optimizer bug</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Suspected-optimizer-bug/m-p/1475517#M166017</link>
      <description>&lt;P&gt;The MKL team is actually investigating already - good!&amp;nbsp; Bug ID with them is&amp;nbsp;MKLD-15217&lt;/P&gt;
&lt;P&gt;I added your find in the FAQs to the bug report.&amp;nbsp; Thank you for finding this, it's a huge help!&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2023 20:02:28 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Suspected-optimizer-bug/m-p/1475517#M166017</guid>
      <dc:creator>Ron_Green</dc:creator>
      <dc:date>2023-04-11T20:02:28Z</dc:date>
    </item>
    <item>
      <title>Re: Suspected optimizer bug</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Suspected-optimizer-bug/m-p/1475604#M166020</link>
      <description>&lt;P&gt;This brings back memories.&amp;nbsp; I recall issues with the optimization of DLAMCH with early releases (c1993) of LAPACK on VAXen and DECstation 3100 workstations.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Apr 2023 00:19:59 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Suspected-optimizer-bug/m-p/1475604#M166020</guid>
      <dc:creator>David_Billinghurst</dc:creator>
      <dc:date>2023-04-12T00:19:59Z</dc:date>
    </item>
    <item>
      <title>Re: Suspected optimizer bug</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Suspected-optimizer-bug/m-p/1475634#M166021</link>
      <description>&lt;P&gt;The version of &lt;A href="https://netlib.org/lapack/explore-html/d5/dd4/dlamch_8f_source.html" target="_self"&gt;dlamch.f included in Lapack 3.11&lt;/A&gt; gets all the information it needs using the standard intrinsic functions EPSILON(), TINY(), DIGITS(), etc., instead of tricky code that does not work well with optimization .&lt;/P&gt;</description>
      <pubDate>Wed, 12 Apr 2023 02:35:13 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Suspected-optimizer-bug/m-p/1475634#M166021</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2023-04-12T02:35:13Z</dc:date>
    </item>
    <item>
      <title>Re: Suspected optimizer bug</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Suspected-optimizer-bug/m-p/1475670#M166022</link>
      <description>&lt;P&gt;Yes.&amp;nbsp; The version using intrinsic functions version is much better - eliminating recurring issues.&amp;nbsp; I had forgotten I had switched to that code eons ago.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Apr 2023 04:46:01 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Suspected-optimizer-bug/m-p/1475670#M166022</guid>
      <dc:creator>David_Billinghurst</dc:creator>
      <dc:date>2023-04-12T04:46:01Z</dc:date>
    </item>
    <item>
      <title>Re: Suspected optimizer bug</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Suspected-optimizer-bug/m-p/1475912#M166031</link>
      <description>&lt;P&gt;I have never knowingly used LAPACK,&amp;nbsp; but looking at the code for this routine, the use of FIRST shows the writers made a clever use of the save function, it was not obvious on the first 20 reads, but I got it, but then used C eq to one as a true statement.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The first was not obvious to a casual user and the second could have used logicals and not relied on one being one in Fortran.&amp;nbsp; I would suggest it was not written by one person.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Apr 2023 17:20:32 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Suspected-optimizer-bug/m-p/1475912#M166031</guid>
      <dc:creator>JohnNichols</dc:creator>
      <dc:date>2023-04-12T17:20:32Z</dc:date>
    </item>
  </channel>
</rss>

