Re: undefined variable problem



On 2007-03-30, John Appleyard <spamtrap@xxxxxxxxxxxxxx> wrote:

Check out Catherine's reply again. I think you may have misunderstood
what the compiler means by "undefined". It doesn't mean "not allocated"
or "not declared" or "not associated". It means "used before set" -
i.e. no value has been assigned to a since it was created (by allocation
or whatever). It is an error to use the value of a variable if it has
never been given a value, and that is what the compiler is complaining
about.

Hmm... now that I think of it... i've fixed a problem that made
the error go away... maybe it is what you are mentioning here...

The situation I have basically boils down to the following: I
allocated a rank 2 array (representing a matrix), and i only
assigned values to the *lower triangular part*. My application
required the *upper triangular part without the diagonal* to be
zero... but i forgot to
explicitly set that part to zero... so after allocation and setting
the lower triangular part, I couldn't be sure that the values in the
upper triangular part were zero...

Could it be that the NAGWare f95 compiler was smart enough to
detect that the *upper triangular part* of the rank2 array
(matrix) that I was using was not initialised and therefore
reported the error?

Best wishes,
Bart

--
"Share what you know. Learn what you don't."
.



Relevant Pages

  • Re: undefined variable problem
    ... i.e. no value has been assigned to a since it was created (by allocation ... upper triangular part were zero... ... will get subscript checking and a lot more of that ilk ... On my desktop G5 PowerMac NAGWare runs through the GCC backend. ...
    (comp.lang.fortran)
  • Re: Zero-fill-on-demand technique: why it is needed?
    ... The process only thinks it has a piece of memory which was zero filled ... in fact the allocation and zero filling ... The on-demand zero filling technique is also purely about performance. ... bytes wide, and then read from them all, the operating system will map ...
    (comp.os.linux.development.system)
  • Re: (MS-)DOS PC on a microcontroller??
    ... memory block of zero bytes. ... The pointer returned if the ... Each such allocation shall yield a pointer to ... support malloc/calloc requests for 0 bytes and whether or not the ...
    (comp.arch.embedded)
  • Re: allocate array
    ... I'm afraid you have bigger problems than that. ... function results to be exactly zero. ... If the function might have a root at a point where it ... of having an allocation failure on something this small are pretty low. ...
    (comp.lang.fortran)
  • Re: [PATCH] Re: 2.6.21-rc7-mm2 -- hvsi console driver registration failure
    ... We have been seeing panics on boot from the ... this seems to come from hvsi driver trying to ... register itself via tty_register_driverwith a zero units. ... allocation at the smallest size. ...
    (Linux-Kernel)