aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorTobias Schlüter <tobias.schlueter@physik.uni-muenchen.de>2004-12-08 13:27:54 +0100
committerTobias Schlüter <tobi@gcc.gnu.org>2004-12-08 13:27:54 +0100
commit40f2165e2de6ad91cd026f154abc32f1be456bd7 (patch)
tree951a9de75e76aabaafa96a1b09a9545d635165cf /gcc
parent180684ebb290ed587f4727408ebcb72522428a27 (diff)
downloadgcc-40f2165e2de6ad91cd026f154abc32f1be456bd7.zip
gcc-40f2165e2de6ad91cd026f154abc32f1be456bd7.tar.gz
gcc-40f2165e2de6ad91cd026f154abc32f1be456bd7.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fortran/ChangeLog5
-rw-r--r--gcc/fortran/resolve.c11
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gfortran.dg/assign_1.f907
4 files changed, 24 insertions, 3 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 132275f..96c67b1 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -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>
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index e592a02..ecc3a35 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 b832863..81d2aa2 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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.
diff --git a/gcc/testsuite/gfortran.dg/assign_1.f90 b/gcc/testsuite/gfortran.dg/assign_1.f90
new file mode 100644
index 0000000..ccfe866
--- /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