https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85786

--- Comment #12 from kargl at gcc dot gnu.org ---
(In reply to Angus Gibson from comment #11)
> Apologies if this is unrelated to the issue at hand (I don't quite
> understand how everything is inter-related yet), but maybe it helps. First
> up, here's what valgrind says about the segfault:
> 
> ...
> loc(cs%v(2)%p) = 101158160
> ==4100== Use of uninitialised value of size 8
> ==4100==    at 0x109820: query_ptr.3790 (test_verb.f90:49)
> ==4100==    by 0x109FE3: MAIN__ (test_verb.f90:27)
> ==4100==    by 0x10A108: main (test_verb.f90:27)
> ==4100==
> ==4100== Invalid read of size 8
> ==4100==    at 0x109820: query_ptr.3790 (test_verb.f90:49)
> ==4100==    by 0x109FE3: MAIN__ (test_verb.f90:27)
> ==4100==    by 0x10A108: main (test_verb.f90:27)
> ==4100==  Address 0x20050786e0 is not stack'd, malloc'd or (recently) free'd
> ==4100==
> 
> And with an even simpler example, gdb encounters an internal error (it's
> actually very easy to trigger with pointers).
> 
>     program test
>       type t
>          real, dimension(:,:), pointer :: p => null()
>       end type t
>       real, dimension(2,2), target :: e
>       type(t), pointer :: cs
>       allocate(cs)
>       cs%p => e
>       e = 42
>       print *, 'done'
>     end program test
> 
> In gdb:
> 
>     (gdb) info locals
>     cs = 0x55555575a850
>     e = (( 42, 42) ( 42, 42) )
>     (gdb) print cs
>     $1 = (PTR TO -> ( Type t )) 0x55555575a850
>     (gdb) print cs%p
>     value.c:3116: internal-error: value* value_primitive_field(value*,
> LONGEST, int, type*): Assertion `PROP_CONST == TYPE_DATA_LOCATION_KIND
> (type)' failed.

Angus,

Are you testing with a version of trunk after Paul accidentally committed
the patch from comment #5?  With trunk and the above code, I see

% valgrind ./z
==30212== Command: ./z
==30212== 
 done
==30212== 
==30212== HEAP SUMMARY:
==30212==     in use at exit: 0 bytes in 0 blocks
==30212==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==30212== 
==30212== All heap blocks were freed -- no leaks are possible
==30212== 
==30212== For counts of detected and suppressed errors, rerun with: -v
==30212== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

Reply via email to