------- Comment #8 from pault at gcc dot gnu dot org 2007-11-17 17:18 ------- (In reply to comment #7) > Ah! ubound.51 is not declared anywhere in spec_test.
This comes about because the character length for 'tricky' depends on a characteristic of a variable, declared in tricky, that is not a dummy argument. This is the nub of PR 33998 and I propose to transfer that part of this PR to 33998. As well as the fix of #6, this PR needs a bit more: The testcase below fails with.... /cygdrive/c/DOCUME~1/ADMINI~1/LOCALS~1/Temp/ccPP5t7g.o:pr31213.f90:(.tex : undefined reference to `____MOD_i' /cygdrive/c/DOCUME~1/ADMINI~1/LOCALS~1/Temp/ccPP5t7g.o:pr31213.f90:(.tex : undefined reference to `____MOD_i' /cygdrive/c/DOCUME~1/ADMINI~1/LOCALS~1/Temp/ccPP5t7g.o:pr31213.f90:(.tex : undefined reference to `____MOD_i' /cygdrive/c/DOCUME~1/ADMINI~1/LOCALS~1/Temp/ccPP5t7g.o:pr31213.f90:(.tex : undefined reference to `____MOD_i' /cygdrive/c/DOCUME~1/ADMINI~1/LOCALS~1/Temp/ccPP5t7g.o:pr31213.f90:(.tex : undefined reference to `____MOD_i' /cygdrive/c/DOCUME~1/ADMINI~1/LOCALS~1/Temp/ccPP5t7g.o:pr31213.f90:(.tex : more undefined references to `____MOD_i' follow collect2: ld returned 1 exit status whereas the commented out line works. Evidently, something is awry with the referencing in array_constructor translation. Paul module spec_xpr contains pure function tricky(ugly, j, lb) integer, intent(in) :: j logical, intent(in) :: lb(:) interface yoagly pure function ugly(n) integer, intent(in) :: n complex ugly(n) end function ugly end interface yoagly ! character(tricky_helper(lb)) tricky character(tricky_helper((/(.true., i = 1, j)/))) tricky tricky = repeat('X',len(tricky)) end function tricky pure function tricky_helper(lb) logical, intent(in) :: lb(:) integer tricky_helper tricky_helper = 2*size(lb)+3 end function tricky_helper end module spec_xpr module xtra_fun contains pure function butt_ugly(n) integer, intent(in) :: n complex butt_ugly(n) butt_ugly = cmplx(0.,0.) end function butt_ugly end module xtra_fun program spec_test use spec_xpr use xtra_fun print *, tricky(butt_ugly,5,(/(.TRUE.,i = 1, 5)/)) end program spec_test -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31213