replica nfl jerseysreplica nfl jerseyssoccer jerseyreplica nfl jerseys forums.silverfrost.com :: View topic - Character string is lost
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 

Character string is lost

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> 64-bit
View previous topic :: View next topic  
Author Message
simon



Joined: 05 Jul 2006
Posts: 276

PostPosted: Mon Nov 11, 2024 8:49 pm    Post subject: Character string is lost Reply with quote

I have what seems to be an impossible-to-report problem with a character string getting lost in the 64-bit version! The core of the problem looks something like the following:

Code:
Use m, Only: c2 ! c2 is a character string
Character(Len=16) :: c1
Write ( Unit=c1, Fmt='(A)' ) c2
c1 = c1 ! bug is avoided with this line, as long as this comment is deleted!
Print * c1


I recognise that the above is incomplete code, so it cannot be tested. But I don't know where to begin to start to create an example to illustrate this because the bug does not occur when (a) compiling in 32-bit, (b) adding useless lines like line 4. Even more perplexing, the problem reappears when adding a comment to line 4, and it can also be made to disappear if I delete code that is never even called. The full code is about 160,000 lines. I am happy to try to forward that to Paul if diagnosing this problem does not look like a massive task.
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Tue Nov 12, 2024 8:47 am    Post subject: Reply with quote

Simon

I have not seen UNIT=<character variable> before. Is that legal? It is not faulted by FTN95 but perhaps it should be.
Back to top
View user's profile Send private message AIM Address
simon



Joined: 05 Jul 2006
Posts: 276

PostPosted: Wed Nov 13, 2024 9:10 pm    Post subject: Reply with quote

Hi Paul,
I've been using Unit=character for years, actually probably decades.
Actually, in this case, I don't think it is integral to the problem I am experiencing since I have other examples that do not use this construct anyway. But, yes, it is probably worth checking how FTN95 handles it. I am uncertain of what the Fortran standard is, but my understanding is that Unit becomes a negative number when it is using an internal file. But it may well be illegal to attempt to pass the character explicitly as the Unit number. If anybody knows I would be happy to hear.
Simon
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Thu Nov 14, 2024 8:41 am    Post subject: Reply with quote

Simon

Ah yes. I did not recognise it as an internal write statement.

Have you looked at the point of failure using the debugger?
Have you tried omitting the ONLY in the USE statement?
Back to top
View user's profile Send private message AIM Address
simon



Joined: 05 Jul 2006
Posts: 276

PostPosted: Sat Nov 16, 2024 1:24 am    Post subject: Reply with quote

Hi Paul,
Unfortunately, if I try to compile using /DEBUG /CHECK, I get the following error somewhere else in the program:
Quote:
AMD backend failure:Failed to do register-memory emit for MOV_Q at ...

in each case at a Subroutine declaration. Plus I get some Internal compiler errors, again at some Subroutine declarations. None of these problems occur when compiling without those options, nor do they occur when compiling in 32-bit, with or without.
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Sat Nov 16, 2024 8:58 am    Post subject: Reply with quote

Simon

1) Please send a simple program that illustrates the /64 /CHECK failure. This is probably something that we need to fix.

2) Try using /DEBUG on its own. That might help you to work out what is going wrong.
Back to top
View user's profile Send private message AIM Address
simon



Joined: 05 Jul 2006
Posts: 276

PostPosted: Sat Nov 16, 2024 5:32 pm    Post subject: Reply with quote

Hi Paul,
I will try to send a simple program, but I estimate it will take more than a full day's work, so I can't promise to do it soon.
If I remove /CHECK, then I no longer et compilation errors. and some of the runtime errors go away. When I get some free time, I will try to isolate all these issues ...
Back to top
View user's profile Send private message
mecej4



Joined: 31 Oct 2006
Posts: 1898

PostPosted: Tue Nov 19, 2024 4:26 am    Post subject: Reply with quote

Here are portions of F2008 that pertain:
Quote:
F2008:
9.6.2R913: io-control-spec is UNIT = io-unit OR ...
9.5.1: R901: io-unit is file-unit-number OR * OR internal-file-variable

Here is the source of a modified version of the test program that runs correctly with the 9.05 version of FTN95
Code:

module m
character(12) :: c2 = 'String c2xyz'
end module

program buggy
Use m, Only: c2 ! c2 is a character string
Character(Len=16) :: c1
Write ( Unit=c1, Fmt='(A)' ) c2
Print *, c1
end program
Back to top
View user's profile Send private message
simon



Joined: 05 Jul 2006
Posts: 276

PostPosted: Tue Nov 19, 2024 5:37 pm    Post subject: Reply with quote

Thanks for the confirmation. It appears that my partial code was legal, so I'll have to try and find a way to isolate the problem.
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 -> 64-bit 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