* [patch, fortran, committed] Fix PR 50130
@ 2011-08-21 19:25 Thomas Koenig
0 siblings, 0 replies; only message in thread
From: Thomas Koenig @ 2011-08-21 19:25 UTC (permalink / raw)
To: fortran, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 455 bytes --]
Hello world,
I committed the attached patch as obvious after regression-testing.
Revision is 177940.
Will commit to 4.6 in a few days.
Thomas
2011-08-21 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/50130
* resolve.c (resolve_array_ref): Don't calculate upper bound
if the stride is zero.
2011-08-21 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/50130
* gfortran.dg/zero_stride_1.f90: New test
[-- Attachment #2: p1.diff --]
[-- Type: text/x-patch, Size: 772 bytes --]
Index: resolve.c
===================================================================
--- resolve.c (Revision 177746)
+++ resolve.c (Arbeitskopie)
@@ -4569,10 +4569,11 @@ resolve_array_ref (gfc_array_ref *ar)
/* Fill in the upper bound, which may be lower than the
specified one for something like a(2:10:5), which is
identical to a(2:7:5). Only relevant for strides not equal
- to one. */
+ to one. Don't try a division by zero. */
if (ar->dimen_type[i] == DIMEN_RANGE
&& ar->stride[i] != NULL && ar->stride[i]->expr_type == EXPR_CONSTANT
- && mpz_cmp_si (ar->stride[i]->value.integer, 1L) != 0)
+ && mpz_cmp_si (ar->stride[i]->value.integer, 1L) != 0
+ && mpz_cmp_si (ar->stride[i]->value.integer, 0L) != 0)
{
mpz_t size, end;
[-- Attachment #3: zero_stride_1.f90 --]
[-- Type: text/plain, Size: 213 bytes --]
! { dg-do compile }
! PR 50130 - this caused an ICE. Test case supplied by Joost
! VandeVondele.
integer, parameter :: a(10)=0
integer, parameter :: b(10)=a(1:10:0) ! { dg-error "Illegal stride of zero" }
END
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-08-21 12:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-21 19:25 [patch, fortran, committed] Fix PR 50130 Thomas Koenig
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).