Re: allocation error




Richard Maine wrote:
lane straatman <grumpy196884@xxxxxxxxxxx> wrote:

allocate(pascal(1:n))
write (*,'(a)', advance='no') 'give me an int'
read (*, '(i3)') n
...
*** Error 112, Reference to undefined variable, array element or
function result (/UNDEF)

That's because your allocate is before you read the value of n. Allocate
is an executable statement. It does its thing when it is executed, which
in this case is before n is defined. My guess is that you are thinking
it does something more complicated like make the array size track the
value of n as n changes. Nope, it is much simpler than that.

Question, Richard--would the use of a STAT variable if it had been used
(and subsequently tested, of course) been required to catch this
particular error? Or is the undefined status of n a non-required error
to be caught?

.



Relevant Pages

  • Re: allocation error
    ... lane straatman wrote: ... write ', advance='no') 'give me an int' ... That's because your allocate is before you read the value of n. ... is an executable statement. ...
    (comp.lang.fortran)
  • [PATCH] bigphysarea for 2.6.10 en 2.6.11
    ... +contineous memory for the entire runtime of Linux. ... +The big physical area is mainly managed by two functions. ... +caddr_t bigphysarea_alloc_pages(int count, int align, int priority) ... second it is not possible to allocate some memory ...
    (Linux-Kernel)
  • Suspend 2 merge: 41/51: Ranges (extents).
    ... +int nr_unused_ranges = 0; ... * Returns a whole chain of ranges to the unused pool. ... +void put_range_chain ... * be able to allocate contiguous pages. ...
    (Linux-Kernel)
  • Re: A debugging implementation of malloc
    ... True, I do not consider alignment problems, and that could ... If I remember and understand the code correctly, you allocate two ... memcpyto access the int you put at the end of the block will help ... Define a constant for the maximum alignment in bytes, ...
    (comp.lang.c)
  • Re: Weird malloc behaviour
    ... The result, using the Large memory model, is the following: ... wondering why it takes to different segments to allocate a structure ... second BEAM_PROFILE object on the next higher segment address, ...
    (comp.lang.c)