<?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 having trouble running generic linked list program in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/having-trouble-running-generic-linked-list-program/m-p/938771#M89448</link>
    <description>&lt;P&gt;I have a small test program which creates a generic linked list.&amp;nbsp;&amp;nbsp; It compiles, but doesn't run.&lt;/P&gt;

&lt;P&gt;When I try to access the values of the link, it gets a memory error (access violation).&lt;/P&gt;

&lt;P&gt;The values of the list are pointers to unlimited polymorphic variables.&lt;/P&gt;

&lt;P&gt;I have attached the code.&lt;/P&gt;

&lt;P&gt;Can you tell me what I'm doing wrong?&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Thu, 06 Mar 2014 01:57:44 GMT</pubDate>
    <dc:creator>Terry_Wong</dc:creator>
    <dc:date>2014-03-06T01:57:44Z</dc:date>
    <item>
      <title>having trouble running generic linked list program</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/having-trouble-running-generic-linked-list-program/m-p/938771#M89448</link>
      <description>&lt;P&gt;I have a small test program which creates a generic linked list.&amp;nbsp;&amp;nbsp; It compiles, but doesn't run.&lt;/P&gt;

&lt;P&gt;When I try to access the values of the link, it gets a memory error (access violation).&lt;/P&gt;

&lt;P&gt;The values of the list are pointers to unlimited polymorphic variables.&lt;/P&gt;

&lt;P&gt;I have attached the code.&lt;/P&gt;

&lt;P&gt;Can you tell me what I'm doing wrong?&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 06 Mar 2014 01:57:44 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/having-trouble-running-generic-linked-list-program/m-p/938771#M89448</guid>
      <dc:creator>Terry_Wong</dc:creator>
      <dc:date>2014-03-06T01:57:44Z</dc:date>
    </item>
    <item>
      <title>Hello Terry,</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/having-trouble-running-generic-linked-list-program/m-p/938772#M89449</link>
      <description>&lt;P&gt;Hello Terry,&lt;/P&gt;

&lt;P&gt;I think in link.f90, instead of:&lt;/P&gt;

&lt;P&gt;&amp;nbsp; type link&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; !private&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; class(*), pointer :: value =&amp;gt; null()&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; type(link), pointer :: next =&amp;gt; null()&lt;/P&gt;

&lt;P&gt;you should first define 'next' as:&lt;/P&gt;

&lt;P&gt;&amp;nbsp; type link&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; !private&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; class(*), pointer :: value =&amp;gt; null()&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; class(link), pointer :: next =&amp;gt; null()&lt;BR /&gt;
	&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Otherwise, you will have conflicting pointer type assignments at line 31 (constructor%next =&amp;gt; next) and line 44 (&amp;nbsp;this%next =&amp;gt; next), ie,&amp;nbsp;you would attempting to&amp;nbsp;assign CLASS(link) to TYPE(link).&lt;BR /&gt;
	&amp;nbsp;&lt;/P&gt;

&lt;P&gt;I made that change, and the code compiled and linked, but the executable crashed at line 56 in link.f90, on the select type:&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; subroutine printLink(this)&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; implicit none&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; class(link) :: this&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select type(v =&amp;gt; this%value)&lt;/P&gt;

&lt;P&gt;I don't know if this is a compiler bug or not.&amp;nbsp; I'll need to work through the traceback.&amp;nbsp; I suspect something funny about line 59:&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; type is (character(*))&lt;/P&gt;

&lt;P&gt;I think this is legal, but I'll need to look into it.&lt;/P&gt;

&lt;P&gt;Thank you,&lt;/P&gt;

&lt;P&gt;Patrick&lt;BR /&gt;
	&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Mar 2014 16:17:23 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/having-trouble-running-generic-linked-list-program/m-p/938772#M89449</guid>
      <dc:creator>pbkenned1</dc:creator>
      <dc:date>2014-03-06T16:17:23Z</dc:date>
    </item>
    <item>
      <title>Hello Terry,</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/having-trouble-running-generic-linked-list-program/m-p/938773#M89450</link>
      <description>&lt;P&gt;Hello Terry,&lt;/P&gt;

&lt;P&gt;The access violation is due to a bug in link.f90, subroutine printLinks.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;On first entry, 'curr' is unassociated.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;If you comment out the call to printLink (as shown), the program runs normally.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; subroutine printLinks(this)&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; implicit none&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; class(link) :: this&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; class(link), pointer :: curr&lt;/P&gt;

&lt;P&gt;!!!&amp;nbsp;&amp;nbsp;&amp;nbsp; call printLink(curr)&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; curr =&amp;gt; this%next&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; do while(associated(curr))&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; call printLink(curr)&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; curr =&amp;gt; curr%next&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; enddo&lt;/P&gt;

&lt;P&gt;With that change, things seem normal:&lt;/P&gt;

&lt;P&gt;&amp;gt;ifort link.f90 list_0.f90 generic_linklist.f90 -Fe:foo.exe&lt;/P&gt;

&lt;P&gt;Intel(R) Visual Fortran Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 14.0.2.176 Build 20140130&lt;BR /&gt;
	Copyright (C) 1985-2014 Intel Corporation.&amp;nbsp; All rights reserved.&lt;/P&gt;

&lt;P&gt;Microsoft (R) Incremental Linker Version 11.00.61030.0&lt;BR /&gt;
	Copyright (C) Microsoft Corporation.&amp;nbsp; All rights reserved.&lt;/P&gt;

&lt;P&gt;-out:foo.exe&lt;BR /&gt;
	-subsystem:console&lt;BR /&gt;
	link.obj&lt;BR /&gt;
	list_0.obj&lt;BR /&gt;
	generic_linklist.obj&lt;/P&gt;

&lt;P&gt;&amp;gt;foo&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 6&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 9&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; 1.230000&lt;BR /&gt;
	&amp;nbsp;A&lt;BR /&gt;
	&amp;nbsp;B&lt;/P&gt;

&lt;P&gt;Is that the correct output?&lt;/P&gt;

&lt;P&gt;Thanks,&lt;/P&gt;

&lt;P&gt;Patrick&lt;/P&gt;</description>
      <pubDate>Fri, 07 Mar 2014 17:54:36 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/having-trouble-running-generic-linked-list-program/m-p/938773#M89450</guid>
      <dc:creator>pbkenned1</dc:creator>
      <dc:date>2014-03-07T17:54:36Z</dc:date>
    </item>
    <item>
      <title>Thanks Patrick, that did fix</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/having-trouble-running-generic-linked-list-program/m-p/938774#M89451</link>
      <description>&lt;P&gt;Thanks Patrick, that did fix the problem.&lt;/P&gt;

&lt;P&gt;However, I wanted to print the first element as well, so instead of commenting out the first call to printLink, I preceded it with curr=&amp;gt;this, or I could have used printLink(this).&lt;/P&gt;

&lt;P&gt;One comment, I can't see the value variable in the debugger.&amp;nbsp; Is this because it is a unlimited polymorphic variable?&lt;/P&gt;</description>
      <pubDate>Sun, 09 Mar 2014 03:46:38 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/having-trouble-running-generic-linked-list-program/m-p/938774#M89451</guid>
      <dc:creator>Terry_Wong</dc:creator>
      <dc:date>2014-03-09T03:46:38Z</dc:date>
    </item>
    <item>
      <title>Hi Terry,</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/having-trouble-running-generic-linked-list-program/m-p/938775#M89452</link>
      <description>&lt;P&gt;Hi Terry,&lt;/P&gt;

&lt;P&gt;I don't know of a restriction viewing&amp;nbsp; class(*) variables in the debugger.&amp;nbsp; Could you be more specific?&amp;nbsp; For example, using VS2012, in subroutine addInteger(this, value), I set a breakpoint on the allocate statement at line 56:&lt;/P&gt;

&lt;P&gt;allocate(v,source=value) !! line 56&lt;/P&gt;

&lt;P&gt;With a Debug x64 configuation, I can repeatedly run to that breakpoint and see 'value' updated with every pass:&lt;BR /&gt;
	U506813.exe!LIST_MOD_mp_ADDINTEGER(TYPE(LIST) THIS={...} , INTEGER(4)&amp;nbsp; VALUE=#00000004 ) Line 56&amp;nbsp;Unknown&lt;/P&gt;

&lt;P&gt;What do you see?&lt;/P&gt;

&lt;P&gt;Thanks,&lt;/P&gt;

&lt;P&gt;Patrick&lt;BR /&gt;
	&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Mar 2014 19:51:25 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/having-trouble-running-generic-linked-list-program/m-p/938775#M89452</guid>
      <dc:creator>pbkenned1</dc:creator>
      <dc:date>2014-03-10T19:51:25Z</dc:date>
    </item>
    <item>
      <title>Yes, I can see the what the</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/having-trouble-running-generic-linked-list-program/m-p/938776#M89453</link>
      <description>&lt;P&gt;Yes, I can see the what the variable value contains, but after I allocate v, I cannot see what v contains.&lt;/P&gt;

&lt;P&gt;Also, when I am looping through prinkLink, the debugger cannot show me the value of v or this%value.&lt;/P&gt;

&lt;P&gt;I am using the debugger in 64 bit mode.&lt;/P&gt;

&lt;P&gt;Thanks for looking at it.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Terry&lt;/P&gt;</description>
      <pubDate>Mon, 10 Mar 2014 20:11:58 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/having-trouble-running-generic-linked-list-program/m-p/938776#M89453</guid>
      <dc:creator>Terry_Wong</dc:creator>
      <dc:date>2014-03-10T20:11:58Z</dc:date>
    </item>
    <item>
      <title>A class(*) variable has no</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/having-trouble-running-generic-linked-list-program/m-p/938777#M89454</link>
      <description>&lt;P&gt;A class(*) variable has no type on its own - you need to be within a SELECT TYPE construct and then a new "copy" of the variable will be visible in the debugger and you can see its contents as if it were the selected type.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Mar 2014 20:18:06 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/having-trouble-running-generic-linked-list-program/m-p/938777#M89454</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2014-03-10T20:18:06Z</dc:date>
    </item>
    <item>
      <title>Hi Terry,</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/having-trouble-running-generic-linked-list-program/m-p/938778#M89455</link>
      <description>&lt;P&gt;Hi Terry,&lt;/P&gt;

&lt;P&gt;Thanks for the feedback.&amp;nbsp; Right, I can't see the value of the associate-name variable (ie, the 'v') nor the value of this%value in PrintLink().&amp;nbsp; You might have run into a limitation of the Fortran Expression Evaluator (FEE).&amp;nbsp; I'll ask the developers.&lt;/P&gt;

&lt;P&gt;Patrick&lt;/P&gt;</description>
      <pubDate>Mon, 10 Mar 2014 20:26:30 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/having-trouble-running-generic-linked-list-program/m-p/938778#M89455</guid>
      <dc:creator>pbkenned1</dc:creator>
      <dc:date>2014-03-10T20:26:30Z</dc:date>
    </item>
  </channel>
</rss>

