<?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: 'catastrophic error' when allocating array values in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/catastrophic-error-when-allocating-array-values/m-p/1239659#M153465</link>
    <description>&lt;LI-CODE lang="markup"&gt;function l1norm(matA, matB) result(norm_r)
    real, intent(in)   :: matA(:,:), matB(:,:)
    real   :: norm_r

    norm_r = (sum(abs(matA) - abs(matB)))/(sum(abs(matB)))

    return
  end function l1norm&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This was my 'l1norm' function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for the help! I also want to know whether repeated allocation to any array will write garbage values to it?&lt;/P&gt;</description>
    <pubDate>Tue, 22 Dec 2020 04:47:04 GMT</pubDate>
    <dc:creator>Akshay_Siramdas</dc:creator>
    <dc:date>2020-12-22T04:47:04Z</dc:date>
    <item>
      <title>'catastrophic error' when allocating array values</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/catastrophic-error-when-allocating-array-values/m-p/1239079#M153429</link>
      <description>&lt;P&gt;I'm trying to allocate array value but encountered a catastrophic error while compiling. Here's the function :&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;function poisson_pressure(P, B, dx, dy) result(P_n)
    real, intent(in) :: B(:,:), dx, dy
    real             :: P(:,:), norm=1, P_n(nx,ny), norm_t=1e-6

    P_n = P

    do while (norm &amp;gt; norm_t)

      P(2:nx-1, 2:ny-1) = ((dy**2 * (P_n(3:,2:ny-1)+P_n(1:nx-2,2:ny-1))) &amp;amp;
                          + (dx**2 * (P_n(2:nx-1,3:)+P_n(2:nx-1,1:ny-2))) &amp;amp;
                          - (dx**2 * dy**2 * B(2:nx-1,2:ny-1))) / (2*(dx**2 + dy**2))

      P(:, ny-1) = 0
      P(1, &lt;LI-EMOJI id="lia_slightly-smiling-face" title=":slightly_smiling_face:"&gt;&lt;/LI-EMOJI&gt; = P(2, :)
      P(nx-1, &lt;LI-EMOJI id="lia_slightly-smiling-face" title=":slightly_smiling_face:"&gt;&lt;/LI-EMOJI&gt; = P(nx-2, &lt;LI-EMOJI id="lia_slightly-smiling-face" title=":slightly_smiling_face:"&gt;&lt;/LI-EMOJI&gt;  !!! Line that throws compilation error
      P(:, 1) = P(:, 2)

      norm = l1norm(P, P_n)
      P_n = P
    end do

    return

  end function poisson_pressure&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The program compiles well if I remove the problematic line. I don't understand why this is happening. I've checked declarations, type, shape etc but nothing bad came up. I'm using&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;ifort -c foo.F90&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;as compile command.&lt;/P&gt;</description>
      <pubDate>Sun, 20 Dec 2020 06:08:20 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/catastrophic-error-when-allocating-array-values/m-p/1239079#M153429</guid>
      <dc:creator>Akshay_Siramdas</dc:creator>
      <dc:date>2020-12-20T06:08:20Z</dc:date>
    </item>
    <item>
      <title>Re: 'catastrophic error' when allocating array values</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/catastrophic-error-when-allocating-array-values/m-p/1239095#M153433</link>
      <description>&lt;P&gt;The code that you showed is not a proper external function. No compiler will accept it without corrections and without code in a containing scope.&lt;/P&gt;
&lt;P&gt;For instance, the variables nx and ny appear to be from a containing outer scope. The line before the "problematic line" is also problematic. It is wrong for &lt;EM&gt;l1norm&lt;/EM&gt; to be implicitly declared with the wrong type. Check the subscript expressions.&lt;/P&gt;
&lt;P&gt;If the function is invoked several times, the value of &lt;EM&gt;norm&lt;/EM&gt; at entry will not be 1, and the conditional expression in the DO WHILE statement will probably be evaluated incorrectly.&lt;/P&gt;
&lt;P&gt;Your description does not match the code that you posted. Please show the actual code.&lt;/P&gt;</description>
      <pubDate>Sun, 20 Dec 2020 11:01:29 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/catastrophic-error-when-allocating-array-values/m-p/1239095#M153433</guid>
      <dc:creator>mecej4</dc:creator>
      <dc:date>2020-12-20T11:01:29Z</dc:date>
    </item>
    <item>
      <title>Re: 'catastrophic error' when allocating array values</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/catastrophic-error-when-allocating-array-values/m-p/1239415#M153446</link>
      <description>&lt;P&gt;mecej4,&lt;/P&gt;
&lt;P&gt;In the posted text (program), it appears that the text formatting replace colon, right paren with a non-printing smiley face.&lt;/P&gt;
&lt;P&gt;.OR.&lt;/P&gt;
&lt;P&gt;the OP copied the file from this forum, and missed the colon, right paren to hidden smiley face.&lt;/P&gt;
&lt;P&gt;I am not sure if Past with Fortran formatting still has this problem. Let's see if it does&lt;/P&gt;
&lt;LI-CODE lang="fortran"&gt;array(1,:) = 2 ! left side has array(1,: ) without space following :
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim Dempsey&lt;/P&gt;</description>
      <pubDate>Mon, 21 Dec 2020 16:31:53 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/catastrophic-error-when-allocating-array-values/m-p/1239415#M153446</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2020-12-21T16:31:53Z</dc:date>
    </item>
    <item>
      <title>Re: 'catastrophic error' when allocating array values</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/catastrophic-error-when-allocating-array-values/m-p/1239442#M153447</link>
      <description>&lt;P&gt;I have reported already the tendency of this forum to replace certain common Fortran syntax with invisible emoji (you can see it only in a brief instant of the display of raw HTML when you edit a post.)&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Dec 2020 17:53:19 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/catastrophic-error-when-allocating-array-values/m-p/1239442#M153447</guid>
      <dc:creator>Steve_Lionel</dc:creator>
      <dc:date>2020-12-21T17:53:19Z</dc:date>
    </item>
    <item>
      <title>Re: 'catastrophic error' when allocating array values</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/catastrophic-error-when-allocating-array-values/m-p/1239456#M153448</link>
      <description>&lt;P&gt;From me.rice.edu&amp;nbsp; Professor Akin --&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="fortran"&gt;program  vector_norm 
!   A simple vector norm program, Fortran 90 version
 implicit none
  integer, parameter :: dp = selected_real_kind(14) ! 14 digits
  integer, parameter :: MAX = 1000;           !  Maximum vector size
  integer n;                                  !  Actual vector size
  integer i;                                  !  Loop controls
  real (kind=dp) :: x(MAX)                    !  The vector
  real (kind=dp) :: L1_norm, L2_norm;         !  Work results

  print *,"Enter the vector length: ";
  read  *, n;                             !  User size input
  print *, n                              !  Echo size

  if ( n &amp;gt; MAX ) then                     !  Check validity
    stop "Vector size exceeds dimension, ERROR"; ! Abort run
  end if

!  Input vector contents
  print *,"Enter the vector: "; 
  read *, (x(i), i=1,n)              !  Read values

  L2_norm = sqrt ( sum ( x(:n)*x(:n) ))   ! L2 norm
  L1_norm = sum ( abs(x(:n)) )/n          ! L1 norm 

  write (6,'(" The L2 norm of [")',advance='no') ! Print header
!   Loop over vector contents, (except last)
  do i = 1, n-1
    write (6, '(f10.4, ",")', advance = 'no') x(i) ! List values
  end do 

!  Now last term
  write (6, '(f10.4, " ] is: ")', advance = 'no') x(n) ! Last value

  print *, L2_norm, "."  ;                    !  Print L2
  print *, "The L1 norm is: ", L1_norm, "." ; !  Print L1
   
end program vector_norm

!  Running with file lab_1.dat;
!  4
!  3.14159265358979 5 12e1 .645
!  gives
! Enter the vector length: 
! 4
! Enter the vector: 
! The L2 norm of [ 3.1416, 5.0000, 120.0000, 0.6450 ] is:  120.146933499.
! The L1 norm is: 32.196648163397448.&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;- a nice little program&amp;nbsp; &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Dec 2020 18:10:55 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/catastrophic-error-when-allocating-array-values/m-p/1239456#M153448</guid>
      <dc:creator>JohnNichols</dc:creator>
      <dc:date>2020-12-21T18:10:55Z</dc:date>
    </item>
    <item>
      <title>Re: 'catastrophic error' when allocating array values</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/catastrophic-error-when-allocating-array-values/m-p/1239478#M153451</link>
      <description>&lt;P&gt;Akin's program give the same results in the latest Fortran classic compiler:&amp;nbsp; which is nice to know.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture1.GIF" style="width: 874px;"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/14268i1074E3A5C7A26C8A/image-size/large/is-moderation-mode/true?v=v2&amp;amp;px=999&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" role="button" title="Capture1.GIF" alt="Capture1.GIF" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Dec 2020 19:21:13 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/catastrophic-error-when-allocating-array-values/m-p/1239478#M153451</guid>
      <dc:creator>JohnNichols</dc:creator>
      <dc:date>2020-12-21T19:21:13Z</dc:date>
    </item>
    <item>
      <title>Re: 'catastrophic error' when allocating array values</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/catastrophic-error-when-allocating-array-values/m-p/1239559#M153452</link>
      <description>&lt;P&gt;L1 norm is just the average length on the positive number line for the independent elements of the vector.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Dec 2020 23:29:34 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/catastrophic-error-when-allocating-array-values/m-p/1239559#M153452</guid>
      <dc:creator>JohnNichols</dc:creator>
      <dc:date>2020-12-21T23:29:34Z</dc:date>
    </item>
    <item>
      <title>Re: 'catastrophic error' when allocating array values</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/catastrophic-error-when-allocating-array-values/m-p/1239560#M153453</link>
      <description>&lt;P&gt;Is the L1 norm invariant under a transformation of the base&lt;/P&gt;</description>
      <pubDate>Mon, 21 Dec 2020 23:30:13 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/catastrophic-error-when-allocating-array-values/m-p/1239560#M153453</guid>
      <dc:creator>JohnNichols</dc:creator>
      <dc:date>2020-12-21T23:30:13Z</dc:date>
    </item>
    <item>
      <title>Re: 'catastrophic error' when allocating array values</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/catastrophic-error-when-allocating-array-values/m-p/1239563#M153455</link>
      <description>&lt;OL&gt;
&lt;LI&gt;&lt;SPAN&gt;L1 Norm is the sum of the magnitudes of the vectors in a space&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&lt;SPAN&gt;Is the Fortran code in error?&amp;nbsp; Because Akins has divided the sum by the number of vectors&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Dec 2020 23:35:16 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/catastrophic-error-when-allocating-array-values/m-p/1239563#M153455</guid>
      <dc:creator>JohnNichols</dc:creator>
      <dc:date>2020-12-21T23:35:16Z</dc:date>
    </item>
    <item>
      <title>Re: 'catastrophic error' when allocating array values</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/catastrophic-error-when-allocating-array-values/m-p/1239566#M153456</link>
      <description>&lt;P&gt;It is an internal function. The line before the problematic line had correct closed parentheses but idk why when I posted got removed in formatting. The norm value changes every time `l1norm` is invoked. May I know why repeated calling changes the value of a variable?&lt;/P&gt;
&lt;P&gt;The posted code is the actual part of the code!&lt;/P&gt;</description>
      <pubDate>Mon, 21 Dec 2020 23:54:35 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/catastrophic-error-when-allocating-array-values/m-p/1239566#M153456</guid>
      <dc:creator>Akshay_Siramdas</dc:creator>
      <dc:date>2020-12-21T23:54:35Z</dc:date>
    </item>
    <item>
      <title>Re: 'catastrophic error' when allocating array values</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/catastrophic-error-when-allocating-array-values/m-p/1239655#M153462</link>
      <description>&lt;P&gt;because nx and ny will have strange value if they exist at all.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Dec 2020 04:31:38 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/catastrophic-error-when-allocating-array-values/m-p/1239655#M153462</guid>
      <dc:creator>JohnNichols</dc:creator>
      <dc:date>2020-12-22T04:31:38Z</dc:date>
    </item>
    <item>
      <title>Re: 'catastrophic error' when allocating array values</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/catastrophic-error-when-allocating-array-values/m-p/1239657#M153463</link>
      <description>&lt;LI-CODE lang="fortran"&gt;function poisson_pressure(P, B, dx, dy) result(P_n)
    real, intent(in) :: B(:,:), dx, dy
    
    integer :: nx = 100
    integer :: ny = 100
    real             :: P(:,:), norm=1, P_n(100,100), norm_t=1e-6

    P_n = P

    do while (norm &amp;gt; norm_t)

      P(2:nx-1, 2:ny-1) = ((dy**2 * (P_n(3:,2:ny-1)+P_n(1:nx-2,2:ny-1))) &amp;amp;
                          + (dx**2 * (P_n(2:nx-1,3:)+P_n(2:nx-1,1:ny-2))) &amp;amp;
                          - (dx**2 * dy**2 * B(2:nx-1,2:ny-1))) / (2*(dx**2 + dy**2))

      P(:, ny-1) = 0
      P(1,:)  = P(2, :)
      P(nx-1,:) = P(nx-2,:)   !!! Line that throws compilation error
      P(:, 1) = P(:, 2)

      !norm = l1norm(P, P_n)
      P_n = P
    end do

    return

  end function poisson_pressure&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It compiles now - but I need a calling routine, you cannot expect people to do a lot of work.&amp;nbsp; PS it will not compile until nx and ny are defined and P_n should probably be allocatable.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Dec 2020 04:41:17 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/catastrophic-error-when-allocating-array-values/m-p/1239657#M153463</guid>
      <dc:creator>JohnNichols</dc:creator>
      <dc:date>2020-12-22T04:41:17Z</dc:date>
    </item>
    <item>
      <title>Re: 'catastrophic error' when allocating array values</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/catastrophic-error-when-allocating-array-values/m-p/1239658#M153464</link>
      <description>&lt;P&gt;also supply an l1norm function&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Dec 2020 04:42:09 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/catastrophic-error-when-allocating-array-values/m-p/1239658#M153464</guid>
      <dc:creator>JohnNichols</dc:creator>
      <dc:date>2020-12-22T04:42:09Z</dc:date>
    </item>
    <item>
      <title>Re: 'catastrophic error' when allocating array values</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/catastrophic-error-when-allocating-array-values/m-p/1239659#M153465</link>
      <description>&lt;LI-CODE lang="markup"&gt;function l1norm(matA, matB) result(norm_r)
    real, intent(in)   :: matA(:,:), matB(:,:)
    real   :: norm_r

    norm_r = (sum(abs(matA) - abs(matB)))/(sum(abs(matB)))

    return
  end function l1norm&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This was my 'l1norm' function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for the help! I also want to know whether repeated allocation to any array will write garbage values to it?&lt;/P&gt;</description>
      <pubDate>Tue, 22 Dec 2020 04:47:04 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/catastrophic-error-when-allocating-array-values/m-p/1239659#M153465</guid>
      <dc:creator>Akshay_Siramdas</dc:creator>
      <dc:date>2020-12-22T04:47:04Z</dc:date>
    </item>
    <item>
      <title>Re: 'catastrophic error' when allocating array values</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/catastrophic-error-when-allocating-array-values/m-p/1239744#M153466</link>
      <description>&lt;P&gt;If you wish&amp;nbsp;norm&lt;FONT color="#a67f59"&gt;&lt;SPAN style="background-color: rgba(255, 255, 255, 0.5);"&gt;=1 to be set every time this is called you need it to be set by a runtime statement. Not by a compile time initialisation.&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#a67f59"&gt;&lt;SPAN style="background-color: rgba(255, 255, 255, 0.5);"&gt;I don't see an allocatables in the sample BTW.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Dec 2020 09:47:45 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/catastrophic-error-when-allocating-array-values/m-p/1239744#M153466</guid>
      <dc:creator>andrew_4619</dc:creator>
      <dc:date>2020-12-22T09:47:45Z</dc:date>
    </item>
    <item>
      <title>Re: 'catastrophic error' when allocating array values</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/catastrophic-error-when-allocating-array-values/m-p/1239845#M153470</link>
      <description>&lt;P&gt;ok -- I am more than a little confused.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Where did you get your L1 Norm from -- it is a single number returned from a vector of lengths.&amp;nbsp; The Manhattan Taxi.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And we need a driving program - something that can be tested in a Fortran compiler.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am not trying to be difficult but you are dealing with busy folk who have a much higher level of knowledge of Fortran than I , but my Pure Maths says -- this is just a little weird without some background.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are using the L1 Norm to determine a delta error there are better ways to calculate it I would think.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Dec 2020 17:31:34 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/catastrophic-error-when-allocating-array-values/m-p/1239845#M153470</guid>
      <dc:creator>JohnNichols</dc:creator>
      <dc:date>2020-12-22T17:31:34Z</dc:date>
    </item>
  </channel>
</rss>

