diff options
author | Tobias Schlüter <tobias.schlueter@physik.uni-muenchen.de> | 2005-03-13 19:46:36 +0100 |
---|---|---|
committer | Tobias Schlüter <tobi@gcc.gnu.org> | 2005-03-13 19:46:36 +0100 |
commit | ee9430623a7f9835d2936cf03f6a29baf2df5a0e (patch) | |
tree | 3f11461daa267e7e0afe1b9b2ddb5b164fc7f4a3 /gcc/fortran/resolve.c | |
parent | 8f9c06ca82a4d5b10fd2b88e3267036c4f12c779 (diff) | |
download | gcc-ee9430623a7f9835d2936cf03f6a29baf2df5a0e.zip gcc-ee9430623a7f9835d2936cf03f6a29baf2df5a0e.tar.gz gcc-ee9430623a7f9835d2936cf03f6a29baf2df5a0e.tar.bz2 |
re PR fortran/16907 (Non-integer array indices rejected)
fortran/
PR fortran/16907
* resolve.c (gfc_resolve_index): Allow REAL indices as an extension.
testsuite/
PR fortran/16907
* gfortran.dg/real_index_1.f90: New test.
From-SVN: r96385
Diffstat (limited to 'gcc/fortran/resolve.c')
-rw-r--r-- | gcc/fortran/resolve.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index b51206f..35795c3 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -1701,19 +1701,26 @@ gfc_resolve_index (gfc_expr * index, int check_scalar) if (gfc_resolve_expr (index) == FAILURE) return FAILURE; - if (index->ts.type != BT_INTEGER) + if (check_scalar && index->rank != 0) { - gfc_error ("Array index at %L must be of INTEGER type", &index->where); + gfc_error ("Array index at %L must be scalar", &index->where); return FAILURE; } - if (check_scalar && index->rank != 0) + if (index->ts.type != BT_INTEGER && index->ts.type != BT_REAL) { - gfc_error ("Array index at %L must be scalar", &index->where); + gfc_error ("Array index at %L must be of INTEGER type", + &index->where); return FAILURE; } - if (index->ts.kind != gfc_index_integer_kind) + if (index->ts.type == BT_REAL) + if (gfc_notify_std (GFC_STD_GNU, "Extension: REAL array index at %L", + &index->where) == FAILURE) + return FAILURE; + + if (index->ts.kind != gfc_index_integer_kind + || index->ts.type != BT_INTEGER) { ts.type = BT_INTEGER; ts.kind = gfc_index_integer_kind; |