re PR fortran/83679 (r256113 causes regression on pr77942.f90)

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.

From-SVN: r256263
This commit is contained in:
Steven G. Kargl 2018-01-04 20:16:23 +00:00
parent 166d8f080c
commit 58929d71e1
2 changed files with 12 additions and 2 deletions

View File

@ -1,3 +1,9 @@
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> 2018-01-02 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/83650 PR fortran/83650

View File

@ -1,5 +1,5 @@
/* Simplify intrinsic functions at compile-time. /* Simplify intrinsic functions at compile-time.
Copyright (C) 2000-2017 Free Software Foundation, Inc. Copyright (C) 2000-2018 Free Software Foundation, Inc.
Contributed by Andy Vaught & Katherine Holcomb Contributed by Andy Vaught & Katherine Holcomb
This file is part of GCC. This file is part of GCC.
@ -1990,13 +1990,17 @@ gfc_simplify_cshift (gfc_expr *array, gfc_expr *shift, gfc_expr *dim)
sz = mpz_get_si (size); sz = mpz_get_si (size);
mpz_clear (size); mpz_clear (size);
/* Special case: Zero-sized array. */
if (sz == 0)
return a;
/* Adjust shft to deal with right or left shifts. */ /* Adjust shft to deal with right or left shifts. */
shft = shft % sz; shft = shft % sz;
if (shft < 0) if (shft < 0)
shft += sz; shft += sz;
/* Special case: Shift to the original order! */ /* Special case: Shift to the original order! */
if (sz == 0 || shft % sz == 0) if (shft % sz == 0)
return a; return a;
result = gfc_copy_expr (a); result = gfc_copy_expr (a);