- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear all,
Here I have a simple project. There is no error when linked. But when I debug it(execute to the function "create"), the complier tells me the following message, can anyone tell me why?

The code is as follows:
module mypointer
type vertex
real x,y
endtype
type vertex
real x,y
endtype
type point
type(vertex)coord
integer nbr
endtype
type(vertex)coord
integer nbr
endtype
type ppoint
type(point), pointer::p=>null()
endtype
type(point), pointer::p=>null()
endtype
type facet
real a,b,c,d
type(ppoint)ep(1:2)
integer nbr
endtype
real a,b,c,d
type(ppoint)ep(1:2)
integer nbr
endtype
type halffacet
type(halffacet), pointer::left=>null(), right=>null()
type(facet), pointer::hfacet=>null()
type(point), pointer::hpoint=>null()
real start
type(halffacet),pointer::next
endtype
type(halffacet), pointer::left=>null(), right=>null()
type(facet), pointer::hfacet=>null()
type(point), pointer::hpoint=>null()
real start
type(halffacet),pointer::next
endtype
type(halffacet),pointer:: leftend=>null(), rightend=>null()
integer hsize
type(halffacet),pointer::Eh(
integer npoint
integer hsize
type(halffacet),pointer::Eh(

integer npoint
contains
function create()result(out)
type(halffacet),pointer::out,current
out=>null()
ndepth=0
do
if(ndepth>npoint)exit
allocate(current)
current%left=>out
out=>current
ndepth=ndepth+1
enddo
end function
function create()result(out)
type(halffacet),pointer::out,current
out=>null()
ndepth=0
do
if(ndepth>npoint)exit
allocate(current)
current%left=>out
out=>current
ndepth=ndepth+1
enddo
end function
subroutine initialize()
type(halffacet), pointer::temp(
if(associated(Eh))deallocate(Eh)
hsize = 2 * npoint
allocate(Eh(0:hsize-1))
temp=>Eh
leftend => create( )
rightend => create( )
leftend%left =>NULL()
leftend%right => rightend
rightend%left => leftend
rightend%right =>NULL()
Eh(0) = leftend
Eh(hsize-1) = rightend
end subroutine
type(halffacet), pointer::temp(

if(associated(Eh))deallocate(Eh)
hsize = 2 * npoint
allocate(Eh(0:hsize-1))
temp=>Eh
leftend => create( )
rightend => create( )
leftend%left =>NULL()
leftend%right => rightend
rightend%left => leftend
rightend%right =>NULL()
Eh(0) = leftend
Eh(hsize-1) = rightend
end subroutine
endmodule
program pointertest
use mypointer
npoint=10
call initialize
end program pointertest
use mypointer
npoint=10
call initialize
end program pointertest
Link Copied
0 Replies

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page