From: Thomas Koenig Date: Sun, 16 Dec 2007 21:09:34 +0000 (+0000) Subject: re PR fortran/34305 (ICE with array(real) declaration) X-Git-Tag: releases/gcc-4.3.0~940 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=df80a455ed1e2478e4f296f58cbd5181db4998b5;p=thirdparty%2Fgcc.git re PR fortran/34305 (ICE with array(real) declaration) 2007-12-16 Thomas Koenig PR fortran/34305 * resolve.c (compare_bound): If either of the types of the arguments isn't INTEGER, return CMP_UNKNOWN. 2007-12-16 Thomas Koenig PR fortran/34305 * gfortran.dg/real_dimension_1.f: New test case. From-SVN: r130993 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index ac72fb2ceaec..cf54102adae4 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2007-12-16 Thomas Koenig + + PR fortran/34305 + * resolve.c (compare_bound): If either of the types of + the arguments isn't INTEGER, return CMP_UNKNOWN. + 2007-12-16 Tobias Burnus PR fortran/34246 diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 0df0aa78bcd4..57c17dc40067 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -3149,8 +3149,11 @@ compare_bound (gfc_expr *a, gfc_expr *b) || b == NULL || b->expr_type != EXPR_CONSTANT) return CMP_UNKNOWN; + /* If either of the types isn't INTEGER, we must have + raised an error earlier. */ + if (a->ts.type != BT_INTEGER || b->ts.type != BT_INTEGER) - gfc_internal_error ("compare_bound(): Bad expression"); + return CMP_UNKNOWN; i = mpz_cmp (a->value.integer, b->value.integer); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f25a03650192..82411bd99170 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2007-12-16 Thomas Koenig + + PR fortran/34305 + * gfortran.dg/real_dimension_1.f: New test case. + 2007-12-16 Rask Ingemann Lambertsen * gcc.dg/torture/pr24257.c: Remove -O from options. diff --git a/gcc/testsuite/gfortran.dg/real_dimension_1.f b/gcc/testsuite/gfortran.dg/real_dimension_1.f new file mode 100644 index 000000000000..73e9131aaee4 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/real_dimension_1.f @@ -0,0 +1,7 @@ +! { dg-do compile } +! PR 34305 - make sure there's an error message for specifying a + program test + parameter (datasize = 1000) + dimension idata (datasize) ! { dg-error "must be of INTEGER type|must have constant shape" } + idata (1) = -1 + end