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 

Access Violation in CCOPY

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



Joined: 01 Mar 2012
Posts: 34
Location: Ascot, UK

PostPosted: Fri Feb 23, 2024 5:21 pm    Post subject: Access Violation in CCOPY Reply with quote

We are getting a few cases whereby users are seeing an Access Violation in CCOPY. eg.

The instruction at address xxxxx attempted to write to location 7fff1000

xxxxx CCOPY#[+0026]
xxxxx
xxxxx

This is with code that hasn't changed for donkeys years.
The latest case shows up with a customer who has migrated from WinServer 2012 to 2022 using Citrix. Is it a memory clash with something else on the system ?
We can't reproduce it ourselves and the customer fixes it by re-booting, but then it comes back again later.
Thanks,
Kevin
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Sat Feb 24, 2024 8:30 am    Post subject: Reply with quote

Kevin

1) Is it 32 bits or 64 bits?
2) Do you know what is calling CCOPY#?
3) Which version of FTN95 and the Silverfrost DLLs are being used?
Back to top
View user's profile Send private message AIM Address
Kevin



Joined: 01 Mar 2012
Posts: 34
Location: Ascot, UK

PostPosted: Mon Feb 26, 2024 1:26 pm    Post subject: Reply with quote

Paul,

1) 32bit
2) Either GET_STORAGE@ or GET_GSTORAGE@ although they and the routine that calls them do not appear on the traceback.
3) FTN77 v4.02 and SALFLIBC v12.2.27.20 (27-FEB-2010)

I know what you are going to say and we did try and re-build with a v8.80 of the compiler and dll but hit a different access violation starting in yield_program_control and finishing in constructed_button_procedure@
We couldn't fix that so had to wind back to the old version.
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Mon Feb 26, 2024 6:04 pm    Post subject: Reply with quote

Kevin

Did you really mean FTN77 or should it be FTN95?

Either way, I would need to be able to step through the code and that is not going to be possible for versions dating back to 2010 and before.
Back to top
View user's profile Send private message AIM Address
Kevin



Joined: 01 Mar 2012
Posts: 34
Location: Ascot, UK

PostPosted: Mon Feb 26, 2024 6:36 pm    Post subject: Reply with quote

Paul,
I'm afraid I did mean FTN77. (If it ain't broke, blah blah blah)

As I said, we can't reproduce the crash, so even if you could step through the code, there is no guarantee that it will misbehave.

Any clue as to what CCOPY is doing at that line number ?
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Tue Feb 27, 2024 9:31 am    Post subject: Reply with quote

I quote: "CCOPY@ performs character copying operations where one or both of the lengths is unknown at compile time".

For FTN77 and 32 bit FTN95 the routine is coded directly in assembly code. Here is the 64 bit FTN95 form written in C.

Code:
extern "C" void CCOPY$(const char* source, char* dest, long long sl, long long dl)
{
  char* q = NULL;
  char* d = dest;
  if(sl < 0) sl = 0;
  if(dl < 0) dl = 0;
  if(source < dest && source+sl > dest)
  {
    q = (char*)stack_malloc(sl);
    memcpy(q,source,sl);
    source = q;
  }
  if(dl <= sl)
  {
    memcpy(d,source,dl);
  }
  else
  {
    memcpy(d,source,sl);
    memset(d+sl,' ',dl-sl);
  }
  if(q) stack_free(q);
}


It is typically used by the compiler for Fortran character concatenation when the process is not simple.
Back to top
View user's profile Send private message AIM Address
JohnCampbell



Joined: 16 Feb 2006
Posts: 2554
Location: Sydney

PostPosted: Tue Feb 27, 2024 2:35 pm    Post subject: Reply with quote

In F77, this type of error could have occurred if generating a concatenated string into itself.
It can be overcome by using an explicit defined destination string that is long enough, then copying the result string back to the original destination, with explicit size limits on the final string.
My memory is F77 did not like concatenation that overflowed the destination length, and this was best to check in the Fortran code.
F95 was reliable by 1998, so I stoped using FTN77 a long time ago.
Windows made FTN77.exe difficult to use a long time ago !!
Back to top
View user's profile Send private message
mecej4



Joined: 31 Oct 2006
Posts: 1886

PostPosted: Tue Feb 27, 2024 4:00 pm    Post subject: Reply with quote

Kevin,

As you probably know, the more users with diverse PC hardware and Windows versions use your code, the more likely it is that bugs will be noted and fixed.

If you are able and willing to provide a reproducer with instructions, the issues that you wrote about may be possible to observe and fix. If, as you said, "hasn't changed for donkeys years", the original code itself may serve as a reproducer. If the code ran on a 640K PC, the chances are good, unless the suspected bugs are related to 16-bit Windows API calls.
Back to top
View user's profile Send private message
Kevin



Joined: 01 Mar 2012
Posts: 34
Location: Ascot, UK

PostPosted: Thu Feb 29, 2024 12:15 pm    Post subject: Reply with quote

Thanks all for the feedback.
As I mentioned, we can't reproduce the issue ourselves, so it must be dependent on machine configuration or customer data (as most memory-overwrite issues are).
We will try again to update our code to the latest version of FTN95 but that could be a long-haul as I'm dealing with nearly 2 million lines of code!
Back to top
View user's profile Send private message
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