forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Illegal memory reference

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
cwellard



Joined: 10 Aug 2006
Posts: 4

PostPosted: Thu Aug 10, 2006 12:48 am    Post subject: Illegal memory reference Reply with quote

I am trying to compile the XML library just released at http://www.uszla.me.uk/software/FoX.html

During the compile of the file m_common_attrs.f90, I get the following compile warnings and errors:

ftn95 m_common_attrs.f90 /mod_path ....libs /persist
[FTN95/Win32 Ver. 4.9.0 Copyright (C) Silverforst Ltd 1993-2005]
PROCESSING MODULE [<M_COMMON_ATTRS> FTN95/Win32 v4.9.0]
NO ERRORS [<NUMBER_OF_ENTRIES> FTN95/Win32 v4.9.0]
0104) function has_key(dict,key) result(found)
*** Illegal memory reference
1 ERROR [<HAS_KEY> FTN95/Win32 v4.9.0]
0120) pure function get_key_index(dict,key) result(ind)
*** Illegal memory reference
1 ERROR [<GET_KEY_INDEX> FTN95/Win32 v4.9.0]
0136) function get_value_by_key(dict,key,status) result(value)
*** Illegal memory reference
1 ERROR [<GET_VALUE_BY_KEY> FTN95/Win32 v4.9.0]
NO ERRORS [<REMOVE_KEY_BY_INDEX> FTN95/Win32 v4.9.0]
NO ERRORS [<GET_VALUE_BY_INDEX> FTN95/Win32 v4.9.0]
NO ERRORS [<GET_KEY> FTN95/Win32 v4.9.0]
NO ERRORS [<ADD_ITEM_TO_DICT> FTN95/Win32 v4.9.0]
NO ERRORS [<ADD_KEY_TO_DICT> FTN95/Win32 v4.9.0]
NO ERRORS [<ADD_VALUE_TO_DICT> FTN95/Win32 v4.9.0]
NO ERRORS [<SET_NSURI_BY_INDEX> FTN95/Win32 v4.9.0]
NO ERRORS [<SET_PREFIX_BY_INDEX> FTN95/Win32 v4.9.0]
NO ERRORS [<SET_LOCALNAME_BY_INDEX_S> FTN95/Win32 v4.9.0]
NO ERRORS [<SET_LOCALNAME_BY_INDEX_VS> FTN95/Win32 v4.9.0]
NO ERRORS [<GET_NSURI_BY_INDEX> FTN95/Win32 v4.9.0]
NO ERRORS [<GET_PREFIX_BY_INDEX> FTN95/Win32 v4.9.0]
NO ERRORS [<GET_LOCALNAME_BY_INDEX> FTN95/Win32 v4.9.0]
NO ERRORS [<GET_NSURI_BY_KEYNAME> FTN95/Win32 v4.9.0]
NO ERRORS [<GET_PREFIX_BY_KEYNAME> FTN95/Win32 v4.9.0]
NO ERRORS [<GET_LOCALNAME_BY_KEYNAME> FTN95/Win32 v4.9.0]
NO ERRORS [<INIT_DICT> FTN95/Win32 v4.9.0]
NO ERRORS [<RESIZE_DICT> FTN95/Win32 v4.9.0]
NO ERRORS [<DESTROY_DICT> FTN95/Win32 v4.9.0]
NO ERRORS [<RESET_DICT> FTN95/Win32 v4.9.0]
NO ERRORS [<PRINT_DICT> FTN95/Win32 v4.9.0]
NO ERRORS [<PARSE_STRING_TO_DICT> FTN95/Win32 v4.9.0]
NO ERRORS [<M_COMMON_ATTRS> FTN95/Win32 v4.9.0]
*** Compilation failed

Is this a compiler error?
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7927
Location: Salford, UK

PostPosted: Thu Aug 10, 2006 5:22 am    Post subject: Illegal memory reference Reply with quote

Charles

It looks like a compiler bug. Can you isolate the fault into a few lines and post the code here?
Back to top
View user's profile Send private message AIM Address
cwellard



Joined: 10 Aug 2006
Posts: 4

PostPosted: Sat Aug 12, 2006 12:07 am    Post subject: Illegal memory reference Reply with quote

Sample code which causes the illegal memory reference is as follows:

module attrs
type dict_item
character(len=1), pointer, dimension(Smile :: key
end type dict_item
contains
function str_vs(vs) result(s)
character, dimension(Smile, intent(in) :: vs
character(len=size(vs)) :: s
s = transfer(vs,s)
end function str_vs
function has_key(dict,key) result(found)
type(dict_item), intent(in) :: dict
character(len=*), intent(in) :: key
logical :: found
found = ( key == str_vs(dict%key) )
end function has_key
end module attrs


I believe it is associated with the line " found = ( key == str_vs(dict%key) )". If this is replaced by " key = str_vs(dict%key)" with key changed to intent(inout) then the error disappears.
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7927
Location: Salford, UK

PostPosted: Tue Aug 15, 2006 3:08 am    Post subject: Illegal memory reference Reply with quote

Charles

I have only had a brief look at this and I hope to investigate further however...

This is a compiler bug and on my machine it is restricted to .NET.
At this stage I am not sure what the code should be doing and it is possible that there are programming errors in the code. You could check this out by running in Win32 mode and using the debugger.
Even if there are programming errors the compiler should report a sensible failure message under .NET.

When you check this out I suggest that you pay particular attention to the TRANSFER function to make sure that it is doing what you expect (is it moving a character variable into a character array?).
Back to top
View user's profile Send private message AIM Address
cwellard



Joined: 10 Aug 2006
Posts: 4

PostPosted: Tue Aug 15, 2006 7:43 am    Post subject: Illegal memory reference Reply with quote

Paul,

I'm only compiling in win32 mode as I don't have the .NET environment installed on my machine.

I'm really not sure myself what the code is doing as I extracted this from a recently released Fortran XML library (called FoX). The TRANSFER function moves a character array into a character scalar, which is legal under F95 rules (I think).

The code compiles using the Intel v9.1 compiler, and has been compiled and tested on other compilers - I'm not sure whether it makes it correct, though.

regards

Charles
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7927
Location: Salford, UK

PostPosted: Tue Aug 15, 2006 12:51 pm    Post subject: Illegal memory reference Reply with quote

Charles

What version of FTN95 are you running?
Back to top
View user's profile Send private message AIM Address
cwellard



Joined: 10 Aug 2006
Posts: 4

PostPosted: Tue Aug 15, 2006 6:05 pm    Post subject: Illegal memory reference Reply with quote

Paul,

I am currently running ver 4.9.0.

When compiling at the command line I get the error in Win32 mode (compiler options in Effect are COLOUR DELETE_OBJ_ON_ERROR LIST MINIMISE_REBUILD NO_QUIT NON_STANDARD SINGLE_THREADED. With /checkmate (Win32 mode) the error does not occur. With /clr (.NET mode) the error occurs.

The /checkmate is not a universal panacea: when I added this to the compiler options for the unedited source, the illegal memory reference still occurred - I shall have to generate a new example.

The following snippit may be relevant. If I compile the following

module vs
contains
function vs_str(s) result(vs)
character(len=*), intent(in) :: s
character, dimension(len(s)) :: vs
vs = transfer(s, vs)
end function vs_str
end module vs

I get the warning

[FTN95/Win32 Ver. 4.9.0 Copyright (C) Silverforst Ltd 1993-2005]
PROCESSING MODULE [<VS> FTN95/Win32 v4.9.0]
0003) function vs_str(s) result(vs)
WARNING - In a call to VS_STR from another procedure, the first argument was
of type CHARACTER(LEN=*), it is now INTEGER(KIND=3)
NO ERRORS, 1 WARNING [<VS_STR> FTN95/Win32 v4.9.0]
NO ERRORS [<VS> FTN95/Win32 v4.9.0]

The warning seems to be in error. It only occurs if the function is wrapped in a module.
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7927
Location: Salford, UK

PostPosted: Thu Aug 17, 2006 2:19 am    Post subject: Illegal memory reference Reply with quote

Charles

This bug has now been fixed for the next release.
In fact it had already been fixed for Win32 and we have now fixed it for .NET.
The Win32 fix was not included in the 4.91 patch. Both fixes will be in the next release.
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group