------- Comment #7 from pault at gcc dot gnu dot org 2006-06-15 17:39 ------- Created an attachment (id=11675) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=11675&action=view) A near submission level patch for the PR
I have not marked the previous version as obsolete because it could well be a valuable chunk of a future patch. The attached fixes most of the cases below, except for the last. Array sections, with variable index expressions, in implicit do loops still give an error; in fact the same error as g95! I think I can see how to do that final tweek.... Paul PS Please excuse the state of these "working" test programs; I use them as labs to test and diagnose the patch. program gfortran_bug1 ! real, parameter :: x(4,4) = reshape((/(i, i = 1, 16)/), (/4,4/)) real, parameter :: xx(2) = (/ 12.0, 14.0 /) real, parameter :: xxx(2) = (/ xx - 3 /) character(4), parameter :: chr(4) = (/"abcd", "efgh", "ijkl", "mnop"/), & scalar = "abcd" character(4), parameter :: scalar2 = chr(1)(2:4) ,chrt(2) = (/chr(2:2)(2:3), chr(3:3)(3:4)/) character(2), parameter :: chrr(2) = chr(2:3)(2:3) character(2), parameter :: chrx(2) = (/(chr(i)(2:3), i=2,3)/) ! ! gfortran dies at the following, which AFAICT is legal: ! real, parameter :: y(4) = (/ x(1:2, 2), x(1:2, 4)/) real, parameter :: z(2) = x(1:2, 1) + 1 print *, x print *, z print *, y print *, xxx print *, chrr print *, chrt print *, scalar2 print *, chrx end program gfortran_bug1 program gfortran_bug2 ! ! character(4), parameter :: chr(4) = (/"abcd", "efgh", "ijkl", "mnop"/), & ! scalar = "abcd" ! character(4), parameter :: chrx(2) = (/(chr(i), i=2,3)/) integer, parameter :: m(4) = (/1,2,3,4/) integer, parameter :: n(2) = (/(m(i), i = 2,3)/) integer, parameter :: o(4) = (/(n, i = 2,3)/) integer, parameter :: q(4) = (/((/(m(j), j = i, i+1)/), i = 2,3)/) integer, parameter :: p(8) = (/(m(i:i+1), i = 1,4)/) ! print *, chrx print *, n, o, p end program gfortran_bug2 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16206