- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm having trouble with FoX, an XML parsing library written in FORTRAN. See http://www1.gly.bris.ac.uk/~walker/FoX/. When FoX reads a file, it collects characters one at a time by repeatedly allocating and copying between a pair of CHARACTER(:) pointers. When this array exceeds 998 characters, IVF appears to give an access violation. I reduced the problemmatic code in FoX to the shortish example shown below. I'm using IVF 11.1.067.
Thanks,
Allen
Thanks,
Allen
[bash]module fox_m_fsys_array_str implicit none private interface destroy module procedure destroy_vs end interface interface alloc module procedure vs_str_alloc end interface public :: str_vs public :: vs_str public :: vs_str_alloc public :: vs_vs_alloc public :: alloc public :: destroy contains pure function str_vs(vs) result(s) character, dimension(:), intent(in) :: vs character(len=size(vs)) :: s s = transfer(vs, s) end function str_vs pure function vs_str(s) result(vs) character(len=*), intent(in) :: s character, dimension(len(s)) :: vs vs = transfer(s, vs) end function vs_str pure function vs_str_alloc(s) result(vs) character(len=*), intent(in) :: s character, dimension(:), pointer :: vs allocate(vs(len(s))) vs = vs_str(s) end function vs_str_alloc pure function vs_vs_alloc(s) result(vs) character, dimension(:), pointer :: s character, dimension(:), pointer :: vs if (associated(s)) then allocate(vs(size(s))) vs = s else vs => null() endif end function vs_vs_alloc subroutine destroy_vs(vs) character, dimension(:), pointer :: vs deallocate(vs) end subroutine destroy_vs end module fox_m_fsys_array_str program main use fox_m_fsys_array_str, only: str_vs, vs_str_alloc character, pointer :: tempString1(:) => null() character, pointer :: tempString2(:) => null() tempString2 => vs_str_alloc( "" ) ! Works do i = 1, 998 tempString1 => tempString2 tempString2 => vs_str_alloc( str_vs( tempString1 ) // ' ' ) deallocate( tempString1 ) end do print *, size(tempString2), "'", tempString2, "'" deallocate( tempString2 ) tempString2 => vs_str_alloc( "" ) ! Fails do i = 1, 999 tempString1 => tempString2 tempString2 => vs_str_alloc( str_vs( tempString1 ) // ' ' ) deallocate( tempString1 ) end do print *, size(tempString2), "'", tempString2, "'" read (*,*) end program [/bash]
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It's getting a stack overflow. If you increase the stack reserve size, it passes.
I suspect what is happening is that the function result of the call to vs_str_alloc (the pointer) doesn't get taken off the stack after the pointer assignment completes. We'll take a look at that. Issue ID is DPD200161472.
I suspect what is happening is that the function result of the call to vs_str_alloc (the pointer) doesn't get taken off the stack after the pointer assignment completes. We'll take a look at that. Issue ID is DPD200161472.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I see that FORTRAN Composer XE 2011 update 1 was released. Should I be looking for DPD200161472 in this list http://software.intel.com/en-us/articles/intel-composer-xe-2011-compilers-fixes-list/ ?
Thanks.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, that's what you would look for.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This was fixed in Composer XE 2011 Update 6.

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