<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Approximatrix Forums — Some feedback on debugging dynamic arrays in v2.19]]></title>
		<link>https://forums.approximatrix.com/viewtopic.php?id=416</link>
		<atom:link href="https://forums.approximatrix.com/extern.php?action=feed&amp;tid=416&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Some feedback on debugging dynamic arrays in v2.19.]]></description>
		<lastBuildDate>Mon, 12 Jan 2015 20:11:44 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Some feedback on debugging dynamic arrays in v2.19]]></title>
			<link>https://forums.approximatrix.com/viewtopic.php?pid=1789#p1789</link>
			<description><![CDATA[<p>Thanks very much Jeff.</p><p>The above examples seem to be working now for me.</p>]]></description>
			<author><![CDATA[null@example.com (davidb)]]></author>
			<pubDate>Mon, 12 Jan 2015 20:11:44 +0000</pubDate>
			<guid>https://forums.approximatrix.com/viewtopic.php?pid=1789#p1789</guid>
		</item>
		<item>
			<title><![CDATA[Re: Some feedback on debugging dynamic arrays in v2.19]]></title>
			<link>https://forums.approximatrix.com/viewtopic.php?pid=1787#p1787</link>
			<description><![CDATA[<p>There is a new build <a href="http://simplyfortran.com/download/">available on the Download page</a> that should fix some of the reported debugger issues.&nbsp; The <em>ubound.0</em> and <em>x.0</em> variables&nbsp; should not have been reported at all.&nbsp; They were reported erroneously because the GNU Debugger was suggesting they were valid local variables, but they could not be examined.&nbsp; Regardless, the values would be useless to users as they don&#039;t technically correspond to a Fortran variable per se.</p>]]></description>
			<author><![CDATA[null@example.com (jeff)]]></author>
			<pubDate>Mon, 12 Jan 2015 13:31:54 +0000</pubDate>
			<guid>https://forums.approximatrix.com/viewtopic.php?pid=1787#p1787</guid>
		</item>
		<item>
			<title><![CDATA[Re: Some feedback on debugging dynamic arrays in v2.19]]></title>
			<link>https://forums.approximatrix.com/viewtopic.php?pid=1782#p1782</link>
			<description><![CDATA[<p>Jeff,</p><p>Thanks.</p><p>I have isolated the other issue mentioned at the bottom of my original post in the following example.</p><p>If you put a break on the print *, x(1:10) line you will see the following variables in the Variables panel:</p><div class="codebox"><pre><code>    ubound.0    *indeterminate*
[+] x                 [1000]
    x.0         *indeterminate*</code></pre></div><p>Values in x array seem to be correct <span class="bbu">but</span> ubound.0 and x.0 should not be shown.</p><p>This problem seems to be caused by presence of the internal subroutine &quot;change&quot;.</p><p>Good luck with your investigations.</p><div class="codebox"><pre><code>module test
contains
   subroutine modify(x)
      double precision, intent(inout) :: x(:)
      
      ! print first 10 elements
      print *, x(1:10)
      
      ! modify the elements
      call change
      
   contains
      subroutine change
         ! modify elements and return
         x = 0.0d0
      end subroutine change
      
   end subroutine modify

end module test

program anon

   use test, only: modify

   integer :: i
   double precision :: x(1000)

   x = (/(real(i), i=1,1000)/)
   call modify(x)
   
end program anon</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (davidb)]]></author>
			<pubDate>Thu, 08 Jan 2015 09:26:40 +0000</pubDate>
			<guid>https://forums.approximatrix.com/viewtopic.php?pid=1782#p1782</guid>
		</item>
		<item>
			<title><![CDATA[Re: Some feedback on debugging dynamic arrays in v2.19]]></title>
			<link>https://forums.approximatrix.com/viewtopic.php?pid=1780#p1780</link>
			<description><![CDATA[<p>David,</p><p>A quick update.&nbsp; &nbsp;I think the method Simply Fortran is using to create variables is, in this case,&nbsp; incorrect.&nbsp; I can get proper functionality with a small change to the debugger interface files.&nbsp; I&#039;ll let you know when an update is available.</p>]]></description>
			<author><![CDATA[null@example.com (jeff)]]></author>
			<pubDate>Wed, 07 Jan 2015 14:00:55 +0000</pubDate>
			<guid>https://forums.approximatrix.com/viewtopic.php?pid=1780#p1780</guid>
		</item>
		<item>
			<title><![CDATA[Re: Some feedback on debugging dynamic arrays in v2.19]]></title>
			<link>https://forums.approximatrix.com/viewtopic.php?pid=1779#p1779</link>
			<description><![CDATA[<p>David,</p><p>Simply Fortran&#039;s behavior in this situation (and I agree, it doesn&#039;t work as expected) should most likely be considered a GNU Debugger bug.&nbsp; Simply Fortran does not interact with the GNU Debugger&#039;s conventional command line.&nbsp; Instead, it uses the Machine Interface to communicate with the debugger.&nbsp; To track local variables in an efficient manner, as suggested by the GDB documentation, Simply Fortran creates &quot;variables&quot; in the debugger.&nbsp; When a Fortran array allocation occurs, the variable not only doesn&#039;t register as changed, but also it now appears to point to the wrong location in memory.&nbsp; When frame changes occur, the variables are wiped out and new local variables are generated.&nbsp; Therefore, after returning from the <em>pass_array</em> subroutine, new references to <em>a</em> and <em>n</em> are generated that point to the proper memory location.&nbsp; The bug is that the debugger should know better that, on allocation statements, any variables affected should be updated to point to the proper memory location.</p><p>On the command line in GDB, it appears to work because you&#039;re probably using the &quot;disp&quot; command.&nbsp; This command will evaluate the expression specified and print the result after each breakpoint (or step, whichever the user specifies).&nbsp; Using &quot;disp&quot; would lead to an almost completely non-functional debugger interface because of the sheer quantity of information that would require processing on each step.</p><p>I&#039;ll look into fixing the issue.&nbsp; It&#039;s an odd bug.</p>]]></description>
			<author><![CDATA[null@example.com (jeff)]]></author>
			<pubDate>Wed, 07 Jan 2015 13:38:49 +0000</pubDate>
			<guid>https://forums.approximatrix.com/viewtopic.php?pid=1779#p1779</guid>
		</item>
		<item>
			<title><![CDATA[Some feedback on debugging dynamic arrays in v2.19]]></title>
			<link>https://forums.approximatrix.com/viewtopic.php?pid=1775#p1775</link>
			<description><![CDATA[<p>I find this new feature works sometimes, but not always.</p><p>With the following code, the arrays a and n don&#039;t display properly in the Variables panel when a break is put on the print *, a line. However, they <span class="bbu">do display properly</span> if you select the variables in the source code window and then point to them.</p><p>The Variables panel shows different wrong results for win32 and win64 targets (running on 64bit windows 8.1) and when using static vs. dynamic linking.</p><p>Strangely, once the print *, a has been stepped over, the values in the Variables panel change and become correct.</p><p>The array passed to pass_array always displays properly.</p><p><span class="bbu">Edit</span>: I have also found that it works correctly using gdb from a command window (outside Simply Fortran).</p><div class="codebox"><pre><code>module mmm
contains
   subroutine pass_array(a)
      real, intent(in), dimension(:) :: a
      
      ! Check values (break here to look in debugger)
      print *, a
   end subroutine
end module

program main

   use mmm

   integer num
   integer, allocatable :: n(:)
   real, allocatable :: a(:)
   
   num = 10
   allocate(a(num), n(num))
   
   ! Populate arrays with 1 to num
   a = (/(real(i), i=1, num)/)
   n = (/(i, i=1, num)/)
   
   ! Check values (break here to look in debugger)
   print *, a
   print *, n

   call pass_array(a)
   
end program</code></pre></div><p>In some of my production code, I also see other parts of the dope vector that is used by gfortran to represent the deferred arrays in the Variables panel - parts which should be hidden, e.g. for a real variable x I see x.ubound (seems to be a C struct variable) with a value of *Indeterminate*. However, I have not been able to reproduce a test example for this behaviour and cannot post my production code.</p>]]></description>
			<author><![CDATA[null@example.com (davidb)]]></author>
			<pubDate>Wed, 07 Jan 2015 07:55:48 +0000</pubDate>
			<guid>https://forums.approximatrix.com/viewtopic.php?pid=1775#p1775</guid>
		</item>
	</channel>
</rss>
