> The following fixes PR63152 zeroing the data field only for allocatables, not 
> pointers. The benefit of the patch is a small speedup, and it avoids that 
> code starts to rely on behavior that is undefined in the standard. With this 
> patch, something like
> 
> INTEGER, DIMENSION(:), POINTER :: foo
> IF (ASSOCIATED(foo)) ...
> 
> will be detected by valgrind as undefined behavior.

The code you touch is exercised in four different cases, as far as I can see 
from the assert earlier in the function:

  gcc_assert (sym->attr.pointer || sym->attr.allocatable || sym_has_alloc_comp 
|| has_finalizer);

So do we want to test (sym->attr.allocatable), or (!sym->attr.pointer)? Or, 
asked another way: should we NULLIFY in the case of sym_has_alloc_comp || 
has_finalizer?

FX

Reply via email to