public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
* [Committed] PR fortran/77942 -- test for zero
@ 2016-10-12  8:20 Steve Kargl
  0 siblings, 0 replies; only message in thread
From: Steve Kargl @ 2016-10-12  8:20 UTC (permalink / raw)
  To: fortran, gcc-patches

Committed to 6-branch and trunk.

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


Index: gcc/fortran/simplify.c
===================================================================
--- gcc/fortran/simplify.c	(revision 241006)
+++ gcc/fortran/simplify.c	(working copy)
@@ -1989,7 +1989,7 @@ gfc_simplify_cshift (gfc_expr *array, gf
       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: gcc/testsuite/gfortran.dg/pr77942.f90
===================================================================
--- gcc/testsuite/gfortran.dg/pr77942.f90	(nonexistent)
+++ gcc/testsuite/gfortran.dg/pr77942.f90	(working copy)
@@ -0,0 +1,5 @@
+! { dg-do compile }
+program p
+   character, parameter :: c(2) = 'a'
+   print *, cshift(c(2:1), 1)
+end

-- 
Steve

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-10-11 21:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-12  8:20 [Committed] PR fortran/77942 -- test for zero Steve Kargl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).