------- Comment #1 from paul dot richard dot thomas at cea dot fr 2006-08-29 13:05 ------- (In reply to comment #0) Drew,
You are really uncovering them! A simplified version of your testcase that produces the same fault is: program test type t integer :: i integer :: j end type type (t) :: a(5) call sub('one',a%j) call sub('two',a%i) contains subroutine sub(key,a) integer, intent(out) :: a(:) character(*),intent(in) :: key a = 1 end subroutine end program This produces the code below. You will see that the first call uses a temporary for the integer array, atmp.5, and this in its turn points, via its data field to a temporary A.6.... which has disappeared off the face of the earth! The second call points to A.10, which is properly declared in MAIN. Now, if you get rid of the INTENT(OUT), the declarations to the temporaries are both present and the compilation proceeds correctly. In fact, this could be a temporary workaround for your existing code. Note that is is only components of arrays of derived types that will cause this problem (the fault is around line 1703 of trans-expr.c). I have a patch regtesting right now. I will post it on this PR in just a moment. If you are in a position to try it out, I would be very grateful. Paul MAIN__ () { struct t a[5]; int4 A.10[5]; struct array1_int4 atmp.9; _gfortran_set_std (70, 127, 0); { int4 S.11; { int4 D.935; atmp.5.dtype = 265; atmp.5.dim[0].stride = 1; atmp.5.dim[0].lbound = 0; atmp.5.dim[0].ubound = 4; atmp.5.data = (void *) &A.6; atmp.5.offset = 0; sub ("one", &atmp.5, 3); { int4 S.8; D.935 = -1; S.8 = 1; while (1) { if (S.8 > 5) goto L.2; else (void) 0; a[NON_LVALUE_EXPR <S.8> + -1].j = (*(int4[0:] *) atmp.5.data)[S.8 + D.935]; S.8 = S.8 + 1; } L.2:; } } { int4 D.941; atmp.9.dtype = 265; atmp.9.dim[0].stride = 1; atmp.9.dim[0].lbound = 0; atmp.9.dim[0].ubound = 4; atmp.9.data = (void *) &A.10; atmp.9.offset = 0; sub ("two", &atmp.9, 3); { int4 S.12; D.941 = -1; S.12 = 1; while (1) { if (S.12 > 5) goto L.3; else (void) 0; a[NON_LVALUE_EXPR <S.12> + -1].i = (*(int4[0:] *) atmp.9.data)[S.12 + D.941]; S.12 = S.12 + 1; } L.3:; } } } } -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28885