replica nfl jerseysreplica nfl jerseyssoccer jerseyreplica nfl jerseys forums.silverfrost.com :: View topic - Error with Character Variable is not reported
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 

Error with Character Variable is not reported

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



Joined: 16 Nov 2009
Posts: 155

PostPosted: Wed Jan 13, 2010 12:05 pm    Post subject: Error with Character Variable is not reported Reply with quote

Problem: �Error with Character Variable is not reported�

This is only a minor �problem�: The handbook says that the use of a character variable on both sides of an assignment statement is not permitted. As the test program shows, this is not detected or reported by /Checkmate.

However, it seems to me that the above statement is not fully correct since a �meaningful- assignment of the form

Character_Variable (i:j) = Character_Variable (k:l)

should be (and is) treated correctly.

Klaus Lassmann


Code:

  Winapp
  Program Test
      Implicit None
      Integer                            :: i
      Character (len = 1), Dimension (3) :: Text
      Character (len = 3)                :: Text_all

      Text (1) = 'A'
      Text (2) = 'B'
      Text (3) = 'C'

      Text_all = ''
      Do i = 1,3
        Text_all = Text_all // Text (i)    ! not allowed, but not reported
      End Do
        write (*,*) 'Text_all =', Text_all ! Result wrong

      Do i = 1,3
        Text_all (i:i) = Text (i)
      End Do
        write (*,*) 'Text_all =', Text_all ! Result correct

        Text_all (1:2) = Text_all (2:3)    ! assignement statement
        write (*,*) 'Text_all =', Text_all ! Result correct


      Text (1) = 'a'
      Text (2) = 'b'
      Text (3) = 'c'
      Text_all (1:1) = Text (1)
      Do i = 2,3
        Text_all (1:i) = Text_all (1:i-1) // Text (i) ! allowed ???
      End Do
        write (*,*) 'Text_all =', Text_all            ! Result correct

  End Program Test


Code:

del comp.lis
del *.obj
del *.exe
ftn95 Test.f95 /checkmate /link >> comp.lis
sdbg  Test.exe
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Wed Jul 21, 2010 8:18 am    Post subject: Reply with quote

This program compiles and runs with FTN95 even when using /ISO.
It also runs successfully on a third party compiler.
I have not attempted to try to work out what the Fortran Standard says should happen.
Back to top
View user's profile Send private message AIM Address
JohnHorspool



Joined: 26 Sep 2005
Posts: 270
Location: Gloucestershire UK

PostPosted: Wed Jul 21, 2010 11:37 am    Post subject: Reply with quote

If my memory is correct, this was not allowed (or produce unpredictable results) in fortran 77 running on a VAX/VMS machine, and you would use an additional character string to get around the problem. That is how I have written my code ever since!
Back to top
View user's profile Send private message Visit poster's website
IanLambley



Joined: 17 Dec 2006
Posts: 506
Location: Sunderland

PostPosted: Wed Jul 21, 2010 12:13 pm    Post subject: Reply with quote

If the two ranges do not overlap, then all will be well, otherwise who knows?
Ian
Back to top
View user's profile Send private message Send e-mail
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