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 

Bad code generated with Assigned GOTO and /save

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



Joined: 31 Oct 2006
Posts: 732

PostPosted: Sun Apr 23, 2017 11:15 pm    Post subject: Bad code generated with Assigned GOTO and /save Reply with quote

A large program (http://plato.asu.edu/ftp/other_software/dqed.f.gz), dating back to the 1980-s, contains Assigned GOTO statements and also requires the /save compiler option. The following tiny program reproduces the bug that I encountered when I used the 32-bit FTN95 8.10 on the DQED program.
Code:
      program AsgGoto
      implicit none
      integer nv
      nv = 8
      call dqed(nv)
      print *,'Returned to main'
      end
!
      subroutine dqed(nvars)
      implicit none
      integer nvars,igk
      integer, save :: iflag = 0
      assign 40 to igk
      if (iflag.eq.0) then
          if (nvars.le.0) then
              assign 50 to igk
          end if
      end if
      goto igk
   40 iflag=iflag+1
      return
   50 stop 'xyz'
      end

The two ASSIGN statements result in code similar to
Code:
mov dword ptr [00000024], 004010D0

instead of
Code:
mov dword ptr [00400024], 004010D0

As a result of this, the program aborts with an illegal access to address 00000024.

The test program should function the same way whether /save is used or not, but the bug occurs only when /save is used.

The 64-bit compiler does not have this problem.
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Mon Apr 24, 2017 6:48 am    Post subject: Reply with quote

Thank you. I have made a note that this needs fixing.
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