Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29236 Discussions

Can't set a break point in a Function?

TommyCee
Beginner
837 Views
Sorry if this is dumb question and that I never seemed to notice this before, but:

Is it possible that, for debugging, breakpoints cant be set in a Function?

If this is true, what a disadvantage! I swear I never noticed this before.

I was trying to trace a simple routine that calls a Function (not a subroutine) and set a couple breakpoints in that Function. The Function gets called properly but debug never stops there - zooms right past.
0 Kudos
6 Replies
Steven_L_Intel1
Employee
837 Views
Breakpoints can be set in a function and do work. Did you try setting a breakpoint at the start of the function?
0 Kudos
TommyCee
Beginner
837 Views
Yep.

Since the function is only a dozen lines or so, I put a stop sign on every executable line. It zooms right past. Not sure I ever saw anything quite like this. Quite the puzzler ...
0 Kudos
Steven_L_Intel1
Employee
837 Views
That suggests that the routine you set breakpoints in isn't the one that was called. If you stop at the call to the function and step in, what happens? Or is this a DLL being called from managed code? If so, you need to enable unmanaged code debugging in the Debugging property page of the managed code project.
0 Kudos
TommyCee
Beginner
837 Views
You make a good point, Steve - this is something that occurred to me, too. So I set a break exactly where in Main that the function gets called. F10 steps right over the function call and executes the next line in Main! It never goes out to the Function below.

And no, there's no DLL involved or anything like that. This code is ultra simple.

Hey - I just now figured it out (this is weird):

The function I was using {Ran()} was for generating random numbers and created for F77. I naively oported it to F90 w/o eralizing that F90 has in intrinsic function Ran(). So all the while I was crunching the Main along thinking it was using my function, it was using the F90 intrinsic of the same name! So of course it never traced to the stops in my function: it never went there. And it ain't even Halloween yet!
0 Kudos
Steven_L_Intel1
Employee
837 Views
Yep. The Fortran 90 language does not define RAN as an intrinsic, but the Intel compiler does. Adding EXTERNAL RAN would override this and let your function be called.
0 Kudos
TommyCee
Beginner
837 Views
Ah hahhhh - you just answered another question. In searching, I didn't see where Ran() is a valid F90 intrinsic (zero documentation) but I know for sure it gets implemented. Now you explain why this is happening. I'll try 'EXTERNAL RAN'. Thanks.
0 Kudos
Reply