Re: Does deallocate also nullify a pointer ?

On Dec 9, 11:56 am, nos...@xxxxxxxxxxxxx (Richard Maine) wrote:
reubendb <reube...@xxxxxxxxx> wrote:
On Dec 2, 8:12 pm, nos...@xxxxxxxxxxxxx (Richard Maine) wrote:
reubendb <reube...@xxxxxxxxx> wrote:
Is it part of the standard that passing an allocated pointer to
"deallocate()" alsonullifythe pointer ?

Yes. <snip>
For example, here is my test program and the module:
[code elided]
It seems that this is only a problem when an allocatable array
(NodeList) is a member of the derived type (BasicMeshStructureType),
otherwise it behaves as I expected.

So I am just want to make sure it's not a problem with my program
before I claim that this is a compiler bug.

Looks like a compiler bug to me. (I might note that at least the copy of
g95 I have installed here gets it right).

Thanks. I tested this with gfortran-4.3 and g95 and they seem to get
the right answer too. The compiler I was talking about is PGI, so I
guess I'll try file bug report with them.


Relevant Pages

  • Re: pointer components and memory leaks
    ... that's the same thing as what Paul said. ... Let's not suggest compiler bug every time one finds a problem. ... leak memory, though even there, user bugs in other parts of the code can ...
  • Re: Really wierd bug
    ... > it has to be a compiler bug because it works fine for other population ... > My compiler is Compaq Visual Fortran 1997-1999. ... > with allocating the array sizes because I've defined the arrays as ... your program does indeed contain an array bounds error -- this ...
  • Re: Questions in Optimization !!
    ... that the problem is absolutely, positively not a compiler bug, because ... "But it works as long as I don't use optimization! ... resulting in stack corruption ...
  • Re: Wrong optimisation in Visual Release Build
    ... > It's not a compiler bug; it's bad code that relies on undefined behavior. ... The program in question does not invoke undefined behavior. ... The C++ standard is very clear that evaluation order is not ...
  • Re: mutex question
    ... This is not a compiler bug -- this is a code bug. ... use 'volatile' on variables shared between threads. ... Memory barriers, not volatile, are the correct mechanism to force updating of variables between threads. ...