Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Zhanghong_T_
Beginner
78 Views

try ... catch problem

Dear all,

I have the following C++ code that are called by Fortran program:

            try
            {

                 mycalculation();

           }

           catch(...)

           {

              return -1;

          }

          return 0;

 

However, it seems that the code can't catch the crash at 'mycalculation'. The crash has the following message displayed:

forrtl: severe (157): Program Exception - access violation

 

Could anyone help me to take a look at it?

 

Thanks,

Zhanghong Tang

0 Kudos
4 Replies
SergeyKostrov
Valued Contributor II
78 Views

>>...However, it seems that the code can't catch the crash at 'mycalculation'. .. It would be nice to see an error code returned from an operating system. For example, is it Access Violation, or Divide by Zero, or something else? I think you need to investigate why the crash happens in 'mycalculation' function because without a reproducible test-case it is really hard to say what could be wrong.
Bernard
Black Belt
78 Views

>>>However, it seems that the code can't catch the crash at 'mycalculation'. The crash has the following message displayed:

forrtl: severe (157): Program Exception - access violation>>>

It seems that crash was handled before execution reached catch block. Access violation was signaled by the CPU and was propagated back to the application. Usually when debugger is not connected to the application default procedure will be process termination and log event writing by the OS.

SergeyKostrov
Valued Contributor II
78 Views

>>...forrtl: severe (157): Program Exception - access violation Sorry, I missed it and I think this is a result of out-of-bound access in some data set. Also, Fortran could have a set of its own try-catch-etc traps and they could intercept exceptions before your C++ try-catch.
jimdempseyatthecove
Black Belt
78 Views

Does mycalculation() call any Fortran routines?

Jim Dempsey

Reply