[Patch, fortran] PR35810 - [TR 15581 / F2003] Automatic reallocation on assignment to allocatable variables

Paul Richard Thomas paul.richard.thomas@gmail.com
Mon Nov 29 14:38:00 GMT 2010


Tobias,

> The reason that I see the segfault and others don't is again due
> to the environment variable MALLOC_PERTURB_ whose value is set
> via memset to malloced variables (if one uses GLIBC). If you set
> it to nonzero, you will get the crash. Valgrind shows:
>
> ==23394== Conditional jump or move depends on uninitialised value(s)
> ==23394==    at 0x401B0D: test5.1568 (realloc_on_assign_2.f03:105)
> ==23394==    by 0x400D55: MAIN__ (realloc_on_assign_2.f03:15)
> ==23394==    by 0x402ADC: main (realloc_on_assign_2.f03:18)
> ==23394==
> ==23394== Conditional jump or move depends on uninitialised value(s)
> ==23394==    at 0x401B12: test5.1568 (realloc_on_assign_2.f03:105)
> ==23394==    by 0x400D55: MAIN__ (realloc_on_assign_2.f03:15)
> ==23394==    by 0x402ADC: main (realloc_on_assign_2.f03:18)
>
> Tobias
>

I am finding this hard to understand:

101  xwrkt = trs2a2 (ival, ipic, ncls)                         ! sets
xwrkt (ncls, ncls) = 0.0
102 	if (any (shape (xwrkt) .ne. [ncls, ncls])) call abort
103  xwrkt = invima (xwrkt, ival, ipic, ncls)               ! sets
xwrkt (ival, ival) = 1.0
104 	if (nglobal .ne. 1) call abort
105 	if (sum(xwrkt) .ne. xwrkt(ival, ival)) call abort  ! tests over
xwrkt (1:ncls, 1:ncls)

Do you know what is unititialised?

Cheers

Paul

-- 
The knack of flying is learning how to throw yourself at the ground and miss.
       --Hitchhikers Guide to the Galaxy



More information about the Fortran mailing list