resolve.c (resolve_code): Impose correct restrictions on assigned variable.

fortran/
* resolve.c (resolve_code): Impose correct restrictions on
assigned variable.

testsuite/
* gfortran.dg/assign_1.f90: New test.

From-SVN: r91898
This commit is contained in:
Tobias Schlüter 2004-12-08 13:27:54 +01:00 committed by Tobias Schlüter
parent 180684ebb2
commit 40f2165e2d
4 changed files with 24 additions and 3 deletions

View File

@ -1,3 +1,8 @@
2004-12-08 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
* resolve.c (resolve_code): Impose correct restrictions on
assigned variable.
2004-12-02 Steven G. Kargl <kargls@comcast.net>
Paul Brook <paul@codesourcery.com>

View File

@ -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:

View File

@ -1,3 +1,7 @@
2004-12-08 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
* gfortran.dg/assign_1.f90: New test.
2004-12-08 Nick Clifton <nickc@redhat.com>
* gcc.target/xstormy16/bss_below100: New directory containing tests.

View File

@ -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