diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 132275fb01f..96c67b1fcea 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2004-12-08 Tobias Schlueter + + * resolve.c (resolve_code): Impose correct restrictions on + assigned variable. + 2004-12-02 Steven G. Kargl Paul Brook diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index e592a02ae42..ecc3a3520ae 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -3678,9 +3678,14 @@ resolve_code (gfc_code * code, gfc_namespace * ns) if (code->label->defined == ST_LABEL_UNKNOWN) gfc_error ("Label %d referenced at %L is never defined", code->label->value, &code->label->where); - if (t == SUCCESS && code->expr->ts.type != BT_INTEGER) - gfc_error ("ASSIGN statement at %L requires an INTEGER " - "variable", &code->expr->where); + if (t == SUCCESS + && (code->expr->expr_type != EXPR_VARIABLE + || code->expr->symtree->n.sym->ts.type != BT_INTEGER + || code->expr->symtree->n.sym->ts.kind + != gfc_default_integer_kind + || code->expr->symtree->n.sym->as != NULL)) + gfc_error ("ASSIGN statement at %L requires a scalar " + "default INTEGER variable", &code->expr->where); break; case EXEC_POINTER_ASSIGN: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b832863158c..81d2aa2d654 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2004-12-08 Tobias Schlueter + + * gfortran.dg/assign_1.f90: New test. + 2004-12-08 Nick Clifton * gcc.target/xstormy16/bss_below100: New directory containing tests. diff --git a/gcc/testsuite/gfortran.dg/assign_1.f90 b/gcc/testsuite/gfortran.dg/assign_1.f90 new file mode 100644 index 00000000000..ccfe866a8bc --- /dev/null +++ b/gcc/testsuite/gfortran.dg/assign_1.f90 @@ -0,0 +1,7 @@ +! { dg-do compile } +! Option passed to avoid excess errors from obsolete warning +! { dg-options "-w" } + integer*4 i(5) + assign 1000 to i ! { dg-error "scalar default INTEGER" } + 1000 continue + end