Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

try ... catch problem

Zhanghong_T_
Novice
404 Views

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
404 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.
0 Kudos
Bernard
Valued Contributor I
404 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.

0 Kudos
SergeyKostrov
Valued Contributor II
404 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.
0 Kudos
jimdempseyatthecove
Honored Contributor III
404 Views

Does mycalculation() call any Fortran routines?

Jim Dempsey

0 Kudos
Reply