aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Koenig <tkoenig@gcc.gnu.org>2018-01-03 11:31:20 +0000
committerThomas Koenig <tkoenig@gcc.gnu.org>2018-01-03 11:31:20 +0000
commit8987beac8c4bf6e0b99cb298126041da21964ca4 (patch)
tree4195b7cc7ad021cb2d0747dbe320cb20986f656a
parentb853346e2c2ea98e35c6043712303a5fc8b87dd8 (diff)
downloadgcc-8987beac8c4bf6e0b99cb298126041da21964ca4.zip
gcc-8987beac8c4bf6e0b99cb298126041da21964ca4.tar.gz
gcc-8987beac8c4bf6e0b99cb298126041da21964ca4.tar.bz2
re PR fortran/83664 (Eoshift accepts missing boundary for non-default types)
2018-01-03 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/83664 * check.c (gfc_check_eoshift): Error for missing boundary if array is not one of the standard types. 2018-01-03 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/83664 * gfortran.dg/eoshift_7.f90: New test. From-SVN: r256171
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/check.c20
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/eoshift_7.f9011
4 files changed, 42 insertions, 0 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index b3419e8..e4661a8 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,9 @@
+2018-01-03 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/83664
+ * check.c (gfc_check_eoshift): Error for missing boundary if array
+ is not one of the standard types.
+
2018-01-03 Jakub Jelinek <jakub@redhat.com>
Update copyright years.
diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c
index 48d9852..9f0f4d5 100644
--- a/gcc/fortran/check.c
+++ b/gcc/fortran/check.c
@@ -2270,6 +2270,26 @@ gfc_check_eoshift (gfc_expr *array, gfc_expr *shift, gfc_expr *boundary,
return false;
}
}
+ else
+ {
+ switch (array->ts.type)
+ {
+ case BT_INTEGER:
+ case BT_LOGICAL:
+ case BT_REAL:
+ case BT_COMPLEX:
+ case BT_CHARACTER:
+ break;
+
+ default:
+ gfc_error ("Missing %qs argument to %qs intrinsic at %L for %qs "
+ "of type %qs", gfc_current_intrinsic_arg[2]->name,
+ gfc_current_intrinsic, &array->where,
+ gfc_current_intrinsic_arg[0]->name,
+ gfc_typename (&array->ts));
+ return false;
+ }
+ }
return true;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 2c179b1..822c29d 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2018-01-03 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/83664
+ * gfortran.dg/eoshift_7.f90: New test.
+
2018-01-03 Jan Beulich <jbeulich@suse.com>
* gcc.target/i386/avx512vl-no-vmovdqu8.c,
diff --git a/gcc/testsuite/gfortran.dg/eoshift_7.f90 b/gcc/testsuite/gfortran.dg/eoshift_7.f90
new file mode 100644
index 0000000..fbd017e
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/eoshift_7.f90
@@ -0,0 +1,11 @@
+! { dg-do compile }
+program main
+ type t
+ integer :: x
+ end type t
+ type(t), dimension(2) :: a, b
+ a(1)%x = 1
+ a(2)%x = 2
+ b = eoshift(a,1) ! { dg-error "Missing 'boundary' argument to 'eoshift' intrinsic" }
+ print *,b%x
+end program main