re PR fortran/36192 (ICE with wrong index types and bad parens)
authorSteven G. Kargl <kargl@gcc.gnu.org>
Mon, 26 Oct 2015 17:39:07 +0000 (17:39 +0000)
committerSteven G. Kargl <kargl@gcc.gnu.org>
Mon, 26 Oct 2015 17:39:07 +0000 (17:39 +0000)
2015-10-26  Steven G. Kargl  <kargl@gcc.gnu.org>

PR fortran/36192
* array.c (gfc_ref_dimen_size): Check for BT_INTEGER before calling
mpz_set.

2015-10-26  Steven G. Kargl  <kargl@gcc.gnu.org>

PR fortran/36192
* gfortran.dg/pr36192.f90: New test.

From-SVN: r229387

gcc/fortran/ChangeLog
gcc/fortran/array.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/pr36192.f90 [new file with mode: 0644]

index f7556305678eee1b8ee8643be0a3630227200911..181545117f64dbefc7203e4d220941cc94913063 100644 (file)
@@ -1,3 +1,9 @@
+2015-10-26  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/36192
+       * array.c (gfc_ref_dimen_size): Check for BT_INTEGER before calling
+       mpz_set.
+
 2015-10-26  Andre Vehreschild  <vehre@gcc.gnu.org>
 
        PR fortran/66927
index 2355a980a6112ccfc08f05cdd445714e4ac436fb..940eeafd7b6ce7828103b0b59814c362bd577977 100644 (file)
@@ -2208,7 +2208,8 @@ gfc_ref_dimen_size (gfc_array_ref *ar, int dimen, mpz_t *result, mpz_t *end)
       if (ar->start[dimen] == NULL)
        {
          if (ar->as->lower[dimen] == NULL
-             || ar->as->lower[dimen]->expr_type != EXPR_CONSTANT)
+             || ar->as->lower[dimen]->expr_type != EXPR_CONSTANT
+             || ar->as->lower[dimen]->ts.type != BT_INTEGER)
            goto cleanup;
          mpz_set (lower, ar->as->lower[dimen]->value.integer);
        }
@@ -2222,7 +2223,8 @@ gfc_ref_dimen_size (gfc_array_ref *ar, int dimen, mpz_t *result, mpz_t *end)
       if (ar->end[dimen] == NULL)
        {
          if (ar->as->upper[dimen] == NULL
-             || ar->as->upper[dimen]->expr_type != EXPR_CONSTANT)
+             || ar->as->upper[dimen]->expr_type != EXPR_CONSTANT
+             || ar->as->upper[dimen]->ts.type != BT_INTEGER)
            goto cleanup;
          mpz_set (upper, ar->as->upper[dimen]->value.integer);
        }
index db008b260a3ea9030fc409289f0847f563d709ef..c0f8b0dbf64e81ca923732641514537cd449434e 100644 (file)
@@ -1,3 +1,8 @@
+2015-10-26  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/36192
+       * gfortran.dg/pr36192.f90: New test.
+
 2015-10-26  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gcc.dg/atomic-noinline.c: Change test on __atomic_is_lock_free.
diff --git a/gcc/testsuite/gfortran.dg/pr36192.f90 b/gcc/testsuite/gfortran.dg/pr36192.f90
new file mode 100644 (file)
index 0000000..df3bfd7
--- /dev/null
@@ -0,0 +1,9 @@
+! { dg-do compile }
+! PR fortran/36192.f90
+!
+program three_body
+  real, parameter :: n = 2, d = 2
+  real, dimension(n,d) :: x      ! { dg-error "of INTEGER type|of INTEGER type" }
+  x(1,:) = (/ 1.0, 0.0 /)
+end program three_body
+! { dg-prune-output "have constant shape" }