Silverfrost Forums

Welcome to our forums

Fortran Error

14 Oct 2017 3:07 #20431

Hi Paul: Had a quite trivial error that I made, expressed a condition and if it was true, branched to another label, in this case 100. As it turned out, the label 100 was on a format statement by mistake, caused the compiler to execute without error but did strange things, did not branch to the label but skipped lines of code, tried to execute comment statements, etc. In my estimation, should have caused a compile time error but didn't. Anyway, FYI only. Sid Kraft

14 Oct 2017 11:30 #20435

Here is a test program:

      program xyz
          integer i,j
          i=10
          do
             i=i+1
                 j=i*i
                 if(j > 150)goto 10
                 print 10,i,j
          end do
   10 format(2I10)
      end program

Compiling this with FTN95 8.10, I see the following code for the IF statement:

  0000003E: 81 F8 96 00 00 00  cmp         eax,96h
  00000044: 0F 8E 05 00 00 00  jle         0000004F
  0000004A: E9 FF FF FF FF     jmp         0000004E
  0000004F: 68 13 00 00 00     push        13h

The address 4E in the JMP instruction is the third byte of the current instruction, in the middle!

A similar bug occurs with /64:

 000000000040143E: 81 FB 96 00 00 00  cmp         ebx,96h
  0000000000401444: 0F 8E 05 00 00 00  jle         000000000040144F
  000000000040144A: E9 00 00 00 00     jmp         000000000040144F
  000000000040144F: 90                 nop

Note that now the JMP instruction has a zero offset relative to %RIP, so the JMP works as a NOP!

The compiler does issue a warning:

0008)                  print 10,i,j
WARNING - Label 10 has previously been used as a branch target
0010)    10 format(2I10)
WARNING - This FORMAT statement has been used as a branch target which is a non-standard extension
15 Oct 2017 12:02 #20437

Hi Mecej4: Maybe you can provide an answer to this, I have been using Plato with Win 10, normally when I use the debugger and do a 'step into', it will show an icon that allows me to do the 'step into' and advance line by line. However, lately, when I try to do the 'step into' to advance line by line, it forces me to 'step into' on every line without advancing line by line automatically, all I get is a yellow arrow on each line advanced to and I have to enter the 'step into' command each time before the system will advance. I thought maybe there was an option that caused this and I had accidentally activated it. Please let me know, Sid Kraft

15 Oct 2017 1:25 #20438

Sid, I do not understand at all what you expect the debugger to do. When you press 'Step-Into', the debugger should execute one line, update the variables display, advance the current line indicator (yellow arrow, etc.) to the next line to be executed, and wait for the next input from you.

When the current line is a Fortran statement that does not call a subroutine or evaluate a user-defined function, there is no difference between 'Step-Into' and 'Step-Over'.

When the current line does call a subroutine or evaluate a user-defined function, 'Step-Into' advances the current line to the first executable statement of the subroutine or function. In the same situation, 'Step-Over' advances the current line indicator to the next logical executable statement in the same programming unit, after silently executing all the statements in the subroutine or function that was invoked from the current line.

Can you give a detailed description, with a couple of screen-shots? Please state the compiler version and options used, as well.

15 Oct 2017 3:18 #20439

mecej4

15 Oct 2017 3:21 #20440

mecej4: Be glad to provide screen shots that I took using snipping tool and paint, however, how does one include them in this reply, no option to include screenshots, sorry, not an expert in using this system, Sid kraft

15 Oct 2017 7:26 #20442

There are a number of image hosting sites such as imgbb.com whose main purpose is to hold images for the purpose of inclusion in forum posts. You sign up for an account by giving them an e-mail address, etc., after which you can upload your image file and obtain the BBCode for including that image from the hosting site. You then paste the BBCode in one of your posts, as appropriate.

You can also upload your images to general file repositories such as Google Drive, Dropbox, Onedrive, etc., make the uploaded file public access enabled, obtain a link to the file from the cloud service, and include the link in your post.

Please login to reply.