Home > Archive > Fortran > December 2004 > access violation
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| Nitesh 2004-12-17, 8:57 am |
| Hi,
yes, array A is an argument to the subroutine. In the called
subroutine, the size of A is declared less than that of declared in
the calling subroutine.
How can some part of an array is defined and some part says undefined
address.
Is this "access violation" anywhere relates to the memory problem such
as virtual memory, cache memory or stack size.
Thanks and regards.
Nitesh
| |
| glen herrmannsfeldt 2004-12-17, 3:58 pm |
| Nitesh wrote:
> yes, array A is an argument to the subroutine. In the called
> subroutine, the size of A is declared less than that of declared in
> the calling subroutine.
That should be fine, assuming you stay inside the smaller
dimension. (With most compilers, even the larger dimension
should work.)
If it is a multidimensional array things get more complicate,
and even worse if you get to a case that causes the array
to be copied into the subroutine.
> How can some part of an array is defined and some part says undefined
> address.
> Is this "access violation" anywhere relates to the memory problem such
> as virtual memory, cache memory or stack size.
I would suspect that you are going outside the allocated part
of the array. Turn on bounds checking if your compiler
does that. It might be that bounds checking uses the
declared dimension for the array in the called routine,
but should still work if that is less than in the caller.
-- glen
| |
| Richard E Maine 2004-12-17, 3:58 pm |
| niteshkpatil@rediffmail.com (Nitesh) writes:
> yes, array A is an argument to the subroutine. In the called
> subroutine, the size of A is declared less than that of declared in
> the calling subroutine.
This makes me very suspicious that somewhere, there are array sizes
that aren't what you think they are. There is no way I can
diagnose in any more detail than that without far more information
(most likely including actual code).
Try turning on all bounds checking options (if you didn't already).
> How can some part of an array is defined and some part says undefined
> address.
Trivially. For example, if youi accidentally got it backwards
and the calling subroutine has the smaller array than the called
one (which is illegal, I might add).
And for that matter, once you start corrupting memory by any of
several means (exceeding array bounds and mismatching procedure
areguments are 2 "popular" ways), almost anything can happen.
--
Richard Maine | Good judgment comes from experience;
email: my first.last at org.domain | experience comes from bad judgment.
org: nasa, domain: gov | -- Mark Twain
|
|
|
|
|