re PR fortran/77942 (ICE: Floating point exception, in gfc_simplify_cshift, at fortra...
authorSteven G. Kargl <kargl@gcc.gnu.org>
Tue, 11 Oct 2016 21:03:04 +0000 (21:03 +0000)
committerSteven G. Kargl <kargl@gcc.gnu.org>
Tue, 11 Oct 2016 21:03:04 +0000 (21:03 +0000)
2016-10-11  Steven G. Kargl  <kargl@gcc.gnu.org>

PR fortran/77942
* simplify.c (gfc_simplify_cshift): Check for zero.

2016-10-11  Steven G. Kargl  <kargl@gcc.gnu.org>

PR fortran/77942
* gfortran.dg/pr77942.f90

From-SVN: r241008

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

index e9b88686c488702a2a0dc75cede80e5b3718c0bd..15105753ed54517d0b9c8af8d66432cce4d02fe2 100644 (file)
@@ -1,3 +1,8 @@
+2016-10-11  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/77942
+       * simplify.c (gfc_simplify_cshift): Check for zero.
+
 2016-10-11  Fritz Reese  <fritzoreese@gmail.com>
 
        * iresolve.c (get_radians, get_degrees): Fix sloppy commit.
@@ -5,7 +10,7 @@
 
 2016-10-11  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
 
-       * simplify.c (radians_f): Fix mpdr_mod.
+       * simplify.c (radians_f): Fix mpfr_mod.
        * ireolce.c (get_degrees): Declare tmp.
 
 2016-10-11  Fritz Reese  <fritzoreese@gmail.com>
index eb6e41258fb8297ec8c16a6c32dd4553c7c762ef..b593bce1f4a5975614a1d6bedf0e680c82a3b7b4 100644 (file)
@@ -1989,7 +1989,7 @@ gfc_simplify_cshift (gfc_expr *array, gfc_expr *shift, gfc_expr *dim)
       shft = shft < 0 ? 1 - shft : shft;
 
       /* Special case: Shift to the original order!  */
-      if (shft % sz == 0)
+      if (sz == 0 || shft % sz == 0)
        return a;
 
       result = gfc_copy_expr (a);
index e1ed8e5250f7f22afca8f1e22ef1b20358f65c74..1c574b9189eb650ea816ff61fe90cecfd6aa7a0b 100644 (file)
@@ -1,3 +1,8 @@
+2016-10-11  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/77942
+       * gfortran.dg/pr77942.f90
+
 2016-10-11  Fritz Reese  <fritzoreese@gmail.com>
 
        * gfortran.dg/dec_math.f90: New testsuite.
diff --git a/gcc/testsuite/gfortran.dg/pr77942.f90 b/gcc/testsuite/gfortran.dg/pr77942.f90
new file mode 100644 (file)
index 0000000..7d46afb
--- /dev/null
@@ -0,0 +1,5 @@
+! { dg-do compile }
+program p
+   character, parameter :: c(2) = 'a'
+   print *, cshift(c(2:1), 1)
+end