- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have looked at this thread - https://software.intel.com/en-us/forums/topic/271337 and I have recompiled my code with -check bounds. However this does not print as output anywhere that array boundaries have been exceeded.
However if there is a subroutine that is having an array declared as (*) will that mean this will bypass all array bound checking ?
Regards,
Ashwin.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, we've been told that only the Nag Fortran implements bounds checking for assumed size arrays.
Surprisingly often, we see arrays declared as (*) or (1) when the actual intended size is present in the argument list. "I don't want to know about errors."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for your response.
I am having a difficult time debugging a segmentation fault and no core is dumped to disk. I did recompile with -g -traceback option and when I ran gdb I get hexadecimal addresses with no source code information.
Any other suggestions other than line by line print statements ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ashwin wrote:
However if there is a subroutine that is having an array declared as (*) will that mean this will bypass all array bound checking ?
No, with most compilers bounds checking is skipped for just that variable. Therefore, by successively replacing each '*' with an appropriate expression that is computable from zero or more of the dummy arguments, and fixing the reported array bound errors, you can often narrow down the location of the bug.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I believe it is being thrown inside this subroutine. Because when I try to print any value inside this subroutine all I get is segmentation fault.
Would this code not print out bounds checking for the th3 array ?
subroutine calc_theta (th3,t3,p3, > nx,ny,nz,mdv) implicit none c Declaration of subroutine parameters integer nx,ny,nz real mdv real th3(nx,ny,nz) real t3 (nx,ny,nz) real p3 (nx,ny,nz) real rdcp,tzero,p0 parameter (rdcp=0.286) parameter (tzero=273.15) parameter (p0=100000.) real eps parameter (eps=0.01) c Auxiliary variables integer i,j,k c Calculation do i=1,nx do j=1,ny do k=1,nz if ((abs(t3(i,j,k)-mdv).gt.eps).and. > (abs(p3(i,j,k)-mdv).gt.eps)) then th3(i,j,k)=(t3(i,j,k)+tzero)*( (p0/p3(i,j,k))**rdcp ) else th3(i,j,k)=mdv endif enddo enddo enddo end
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What happens if you rebuild with "-warn interface"? It is possible that you are not passing the arguments correctly. Only by seeing a complete test case can we really help you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Solved it :-)
The problem was with my tcsh. I went to this link https://software.intel.com/en-us/articles/tips-for-debugging-run-time-failures-in-intel-fortran-applicationsand I added this to my shell - limit stacksize unlimited and voila my problem disappeared.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok. You might consider "-heap-arrays" (a compiler option) as an alternative.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page