<?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: VALGRIND: Invalid read/write of size 8 (Fortran pointers) in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/VALGRIND-Invalid-read-write-of-size-8-Fortran-pointers/m-p/1206058#M151577</link>
    <description>&lt;P&gt;What is the value of DIM in this test program? I do not see it set. Oh, and there are other errors, like "ALLOC" instead of "ALLOCATABLE". This program can't be correct.&lt;/P&gt;</description>
    <pubDate>Wed, 02 Sep 2020 09:29:58 GMT</pubDate>
    <dc:creator>Arjen_Markus</dc:creator>
    <dc:date>2020-09-02T09:29:58Z</dc:date>
    <item>
      <title>VALGRIND: Invalid read/write of size 8 (Fortran pointers)</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/VALGRIND-Invalid-read-write-of-size-8-Fortran-pointers/m-p/1206055#M151576</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Dear Sir or Madame,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I came across a Valgrind error message that is related to the use of Fortran pointers. See below for a minimal testcase.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Compiler: ifort (IFORT) 19.0.5.281 20190815&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;IntelMPI: Version 2019 Update 6 Build 20191024 (needed for loading the Valgrind module)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Valgrind: valgrind-3.14.0&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Running&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;valgrind ./a.out&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;produces the error message (among other messages)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;==22137== Invalid write of size 8&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;==22137==&amp;nbsp;&amp;nbsp;&amp;nbsp; at 0x404659: MAIN__ (test.f:11)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;==22137==&amp;nbsp;&amp;nbsp;&amp;nbsp; by 0x4037D1: main (in /p/home/jusers/friedrich1/jureca/git/spex/tests/valgrind/a.out)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;==22137==&amp;nbsp; Address 0x1ffe859090 is on thread 1's stack&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;==22137==&amp;nbsp; in frame #0, created by MAIN__ (test.f:1)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;==22137==&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;==22137== Invalid read of size 8&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;==22137==&amp;nbsp;&amp;nbsp;&amp;nbsp; at 0x404354: MAIN__ (test.f:11)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;==22137==&amp;nbsp;&amp;nbsp;&amp;nbsp; by 0x4037D1: main (in /p/home/jusers/friedrich1/jureca/git/spex/tests/valgrind/a.out)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;==22137==&amp;nbsp; Address 0x1ffe859090 is on thread 1's stack&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;==22137==&amp;nbsp; in frame #0, created by MAIN__ (test.f:1)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;if the program has been compiled in the following way:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;ifort -cpp -O0 -g -DALLOC=pointer -DDIM=63 test.f (and any DIM higher than 63)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;but NOT if it has been compiled like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;ifort -cpp -O0 -g -DALLOC=pointer -DDIM=62 test.f (and any DIM smaller than 62)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ifort -cpp -O0 -g -DALLOC=allocatable -DDIM=63 test.f (and any other DIM).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;GFORTRAN does not produce this error.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would like to know if I should worry about this error. Or is there a violation of the Fortran standard in the code?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;SPAN style="font-family: inherit;"&gt;Best wishes&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Christoph&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;**************&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;TESTCASE:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; program test&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; implicit none&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; real(8), ALLOC :: a(:,:,:), b(:,:,:)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; write(*,*) DIM&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; allocate ( a(DIM,DIM,DIM) )&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; allocate ( b(DIM,DIM,DIM) )&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a = 0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b = 0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a = a - b&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; deallocate(a)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; deallocate(b)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Sep 2020 09:23:50 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/VALGRIND-Invalid-read-write-of-size-8-Fortran-pointers/m-p/1206055#M151576</guid>
      <dc:creator>Christoph_F_</dc:creator>
      <dc:date>2020-09-02T09:23:50Z</dc:date>
    </item>
    <item>
      <title>Re: VALGRIND: Invalid read/write of size 8 (Fortran pointers)</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/VALGRIND-Invalid-read-write-of-size-8-Fortran-pointers/m-p/1206058#M151577</link>
      <description>&lt;P&gt;What is the value of DIM in this test program? I do not see it set. Oh, and there are other errors, like "ALLOC" instead of "ALLOCATABLE". This program can't be correct.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Sep 2020 09:29:58 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/VALGRIND-Invalid-read-write-of-size-8-Fortran-pointers/m-p/1206058#M151577</guid>
      <dc:creator>Arjen_Markus</dc:creator>
      <dc:date>2020-09-02T09:29:58Z</dc:date>
    </item>
    <item>
      <title>Re: VALGRIND: Invalid read/write of size 8 (Fortran pointers)</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/VALGRIND-Invalid-read-write-of-size-8-Fortran-pointers/m-p/1206060#M151578</link>
      <description>&lt;P&gt;DIM and ALLOC are set by the compilation command (preprocessor), e.g.,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;ifort -cpp -O0 -g -DALLOC=pointer -DDIM=63 test.f&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;So, in this case, DIM would be set as "63" and ALLOC would be set as "pointer".&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Christoph&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Sep 2020 09:52:07 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/VALGRIND-Invalid-read-write-of-size-8-Fortran-pointers/m-p/1206060#M151578</guid>
      <dc:creator>Christoph_F_</dc:creator>
      <dc:date>2020-09-02T09:52:07Z</dc:date>
    </item>
    <item>
      <title>Re: VALGRIND: Invalid read/write of size 8 (Fortran pointers)</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/VALGRIND-Invalid-read-write-of-size-8-Fortran-pointers/m-p/1206062#M151579</link>
      <description>&lt;P&gt;Ah, missed that bit - I scrolled down to the source code :). That explains it.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Sep 2020 09:53:29 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/VALGRIND-Invalid-read-write-of-size-8-Fortran-pointers/m-p/1206062#M151579</guid>
      <dc:creator>Arjen_Markus</dc:creator>
      <dc:date>2020-09-02T09:53:29Z</dc:date>
    </item>
    <item>
      <title>Re: VALGRIND: Invalid read/write of size 8 (Fortran pointers)</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/VALGRIND-Invalid-read-write-of-size-8-Fortran-pointers/m-p/1206064#M151580</link>
      <description>&lt;P&gt;I have never used -D but reading the help. "&lt;SPAN&gt;Defines a&amp;nbsp;&lt;/SPAN&gt;symbol name&lt;SPAN&gt;&amp;nbsp;that can be associated with an optional value.&amp;nbsp;&lt;/SPAN&gt;This definition is used during preprocessing in both Intel® Fortran conditional compilation directives and the fpp preprocessor.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;"&lt;/P&gt;
&lt;P&gt;-D It does not define a Fortran variable so I do not think your usage is valid.&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Sep 2020 10:01:08 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/VALGRIND-Invalid-read-write-of-size-8-Fortran-pointers/m-p/1206064#M151580</guid>
      <dc:creator>andrew_4619</dc:creator>
      <dc:date>2020-09-02T10:01:08Z</dc:date>
    </item>
    <item>
      <title>Re: VALGRIND: Invalid read/write of size 8 (Fortran pointers)</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/VALGRIND-Invalid-read-write-of-size-8-Fortran-pointers/m-p/1206066#M151581</link>
      <description>&lt;P&gt;No, what "-DDIM=63" simply does is replacing all occurrences of DIM by 63 before compilation. You can also do that by hand and compile without the preprocessor ("-cpp").&lt;/P&gt;</description>
      <pubDate>Wed, 02 Sep 2020 10:04:29 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/VALGRIND-Invalid-read-write-of-size-8-Fortran-pointers/m-p/1206066#M151581</guid>
      <dc:creator>Christoph_F_</dc:creator>
      <dc:date>2020-09-02T10:04:29Z</dc:date>
    </item>
    <item>
      <title>Re: VALGRIND: Invalid read/write of size 8 (Fortran pointers)</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/VALGRIND-Invalid-read-write-of-size-8-Fortran-pointers/m-p/1206069#M151582</link>
      <description>&lt;P&gt;OK I guess the the different between allocatable and pointer is heap or stack. You maybe have a stack overflow.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Sep 2020 10:13:27 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/VALGRIND-Invalid-read-write-of-size-8-Fortran-pointers/m-p/1206069#M151582</guid>
      <dc:creator>andrew_4619</dc:creator>
      <dc:date>2020-09-02T10:13:27Z</dc:date>
    </item>
    <item>
      <title>Re: VALGRIND: Invalid read/write of size 8 (Fortran pointers)</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/VALGRIND-Invalid-read-write-of-size-8-Fortran-pointers/m-p/1206071#M151583</link>
      <description>&lt;P&gt;Thank you.&lt;/P&gt;
&lt;P&gt;Interesting possibility. I have just checked it: When pointers are allocated, the memory goes to the heap. (I checked the VmStk value of /proc/PID/status.)&lt;/P&gt;</description>
      <pubDate>Wed, 02 Sep 2020 10:32:43 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/VALGRIND-Invalid-read-write-of-size-8-Fortran-pointers/m-p/1206071#M151583</guid>
      <dc:creator>Christoph_F_</dc:creator>
      <dc:date>2020-09-02T10:32:43Z</dc:date>
    </item>
    <item>
      <title>Re: VALGRIND: Invalid read/write of size 8 (Fortran pointers)</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/VALGRIND-Invalid-read-write-of-size-8-Fortran-pointers/m-p/1206109#M151584</link>
      <description>&lt;P&gt;Allocated arrays&amp;nbsp; go on the heap. You might want to read the heap arrays option also or stack size option&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Sep 2020 13:19:11 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/VALGRIND-Invalid-read-write-of-size-8-Fortran-pointers/m-p/1206109#M151584</guid>
      <dc:creator>andrew_4619</dc:creator>
      <dc:date>2020-09-02T13:19:11Z</dc:date>
    </item>
  </channel>
</rss>

