------- Comment #3 from jvdelisle at gcc dot gnu dot org 2007-01-30 14:36 ------- Paul's preliminary patch for pr30284 fixes this bug. The library side still shows a potential problem, but we don't hit it with the test cases here because we are only reading one record.
Here is dump for modified test case in #1: MAIN__ () { static char date[1][1:12] = {"200612231200"}; int4 foo; _gfortran_set_std (70, 127, 0, 0); { int8 D.1365; char A.2[1][1:12]; struct array1_unknown atmp.1; struct __st_parameter_dt dt_parm.0; dt_parm.0.common.filename = "pr30626-1.f90"; dt_parm.0.common.line = 4; atmp.1.dtype = 817; atmp.1.dim[0].stride = 1; atmp.1.dim[0].lbound = 0; atmp.1.dim[0].ubound = 0; atmp.1.data = (void *) &A.2; atmp.1.offset = 0; { int8 S.3; S.3 = 0; while (1) { if (S.3 > 0) goto L.1; __builtin_memmove (&(*(char[0:][1:12] *) atmp.1.data)[S.3], &date[NON_LVALUE_EXPR <S.3>], 12); S.3 = S.3 + 1; } L.1:; } dt_parm.0.internal_unit = (char *) atmp.1.data; dt_parm.0.internal_unit_len = 12; dt_parm.0.internal_unit_desc = (char *) &atmp.1; dt_parm.0.common.unit = 0; dt_parm.0.format = "(i4)"; dt_parm.0.format_len = 4; dt_parm.0.common.flags = 20480; _gfortran_st_read (&dt_parm.0); _gfortran_transfer_integer (&dt_parm.0, &foo, 4); _gfortran_st_read_done (&dt_parm.0); { int8 S.4; D.1365 = -1; S.4 = 1; while (1) { if (S.4 > 1) goto L.2; __builtin_memmove (&date[S.4 + -1], &(*(char[0:][1:12] *) atmp.1.data)[S.4 + D.1365], 12); S.4 = S.4 + 1; } L.2:; } } { struct __st_parameter_dt dt_parm.5; dt_parm.5.common.filename = "pr30626-1.f90"; dt_parm.5.common.line = 5; dt_parm.5.common.unit = 6; dt_parm.5.common.flags = 128; _gfortran_st_write (&dt_parm.5); _gfortran_transfer_integer (&dt_parm.5, &foo, 4); _gfortran_st_write_done (&dt_parm.5); } } -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30626