diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 0e64d91652b..f80f6a0f705 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2008-09-08 Tobias Burnus + + PR fortran/37400 + * symbol.c (gfc_set_default_type): Copy char len. + 2008-09-06 Steven G. Kargl PR fortran/36153 diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c index 0b580794ea2..905b243a225 100644 --- a/gcc/fortran/symbol.c +++ b/gcc/fortran/symbol.c @@ -257,6 +257,12 @@ gfc_set_default_type (gfc_symbol *sym, int error_flag, gfc_namespace *ns) sym->ts = *ts; sym->attr.implicit_type = 1; + if (ts->cl) + { + sym->ts.cl = gfc_get_charlen (); + *sym->ts.cl = *ts->cl; + } + if (sym->attr.is_bind_c == 1) { /* BIND(C) variables should not be implicitly declared. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 18555753d09..af93d158556 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-09-08 Tobias Burnus + + PR fortran/37400 + * gfortran.dg/implicit_12.f90: New test. + 2008-09-07 Thomas Koenig PR fortran/37203 @@ -7,7 +12,7 @@ * gfortran.d/reshape_order_4.f90: New test case. 2008-09-07 Richard Guenther - Ira Rosen + Ira Rosen PR tree-optimization/36630 * gcc.dg/vect/pr36630.c: New test. @@ -18,7 +23,7 @@ related to PURE and statement functions. 2008-09-07 Dorit Nuzman - Ira Rosen + Ira Rosen PR tree-optimization/35642 * lib/target-supports.exp (check_effective_target_vect_short_mult): @@ -35,7 +40,7 @@ 2008-09-06 Jeff Law * gcc.c-torture/execute/memcpy-bi.c: Include - + 2008-09-06 Tobias Burnus PR fortran/37399 diff --git a/gcc/testsuite/gfortran.dg/implicit_12.f90 b/gcc/testsuite/gfortran.dg/implicit_12.f90 new file mode 100644 index 00000000000..8136a183971 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/implicit_12.f90 @@ -0,0 +1,23 @@ +! { dg-do run} +! +! PR fortran/37400 +! +module mod + implicit character(len=*,kind=kind('A')) (Q) + parameter(Q1 = '12345678') ! len=8 + parameter(Q2 = 'abcdefghijkl') ! len=12 + contains + subroutine sub(Q3) + if(len('#'//Q3//'#') /= 15) call abort() + if('#'//Q3//'#' /= '#ABCDEFGHIJKLM#') call abort() + end subroutine sub +end module mod +program startest + use mod + implicit none + if(len('#'//Q1//'#') /= 10) call abort() + if(len('#'//Q2//'#') /= 14) call abort() + if('#'//Q1//'#' /='#12345678#') call abort() + if('#'//Q2//'#' /='#abcdefghijkl#') call abort() + call sub('ABCDEFGHIJKLM') ! len=13 +end program startest