+2018-01-04 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR Fortran/83679
+ * simplify.c (gfc_simplify_cshift): Restore early return for zero-sized
+ array. Update Copyright year while here.
+
2018-01-02 Thomas Koenig <tkoenig@gcc.gnu.org>
Backport from 7-branch
/* Simplify intrinsic functions at compile-time.
- Copyright (C) 2000-2016 Free Software Foundation, Inc.
+ Copyright (C) 2000-2016, 2018 Free Software Foundation, Inc.
Contributed by Andy Vaught & Katherine Holcomb
This file is part of GCC.
sz = mpz_get_si (size);
mpz_clear (size);
+ /* Special case: Zero-sized array. */
+ if (sz == 0)
+ return a;
+
/* Adjust shft to deal with right or left shifts. */
shft = shft % sz;
if (shft < 0)
- shft += sz;
+ shft += sz;
/* Special case: Shift to the original order! */
- if (sz == 0 || shft % sz == 0)
+ if (shft % sz == 0)
return a;
result = gfc_copy_expr (a);