Re: problem with insertStatementAfter(SgStatement &s);

You wrote:

It looks the insertStatementAfter() is confused with end of a loop  
right before
the end of a program. I applied the simple instrumentation program on  

following test fortran program:
          program test
          integer a(20)
          do 10 i = 1, 20
            a(i) = i
10        continue

and got output:
         program test
         call exit_event(3)           //This shouold not be here !
         integer  a(20)
         call entry_event(0)
         call loop_entry_event(1)
         do  i = 1,20
            a(i) = i
         call loop_exit_event(2)

I traced the instrumenter, found that it knows the correct line  
number for
statement "10    continue" right before it performs an  
Then I modified the test program by adding "i=i+1" before the "end",  

instrumenter worked OK.

Any idea about it ?

Without seeing the source code for the "instrumenter", I can't really  
help you. Clearly the undesirable statement:
call exit_event(3)
gets inserted somehow. I have not had any problems with the  
insertStatementAfter(SgStatement &s) method -- I doubt if that is the  
real problem. Any chance you could come up with a short program that  
illustrates the problem you have. If I could look at the source code,  
I might be able to help.   --Beata