https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85786
--- Comment #11 from Angus Gibson <angus at agibson dot me> --- 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.