This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
[Committed] PR fortran/78279 -- convert gcc_assert to internal error
- From: Steve Kargl <sgk at troutmask dot apl dot washington dot edu>
- To: fortran at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Thu, 1 Dec 2016 12:40:13 -0800
- Subject: [Committed] PR fortran/78279 -- convert gcc_assert to internal error
- Authentication-results: sourceware.org; auth=none
- Reply-to: kargl at uw dot edu
I've committed the attached patch, which converts a gcc_assert()
to a conditional express tha may call gfc_internal_error().o
2016-12-01 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/78279
* dependency.c (identical_array_ref): Convert gcc_assert to conditional
and gfc_internal_error.
2016-12-01 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/78279
* gfortran.dg/pr78279.f90: New test.
--
Steve
Index: gcc/fortran/dependency.c
===================================================================
--- gcc/fortran/dependency.c (revision 242789)
+++ gcc/fortran/dependency.c (working copy)
@@ -101,7 +101,9 @@ identical_array_ref (gfc_array_ref *a1,
if (a1->type == AR_ELEMENT && a2->type == AR_ELEMENT)
{
- gcc_assert (a1->dimen == a2->dimen);
+ if (a1->dimen != a2->dimen)
+ gfc_internal_error ("identical_array_ref(): inconsistent dimensions");
+
for (i = 0; i < a1->dimen; i++)
{
if (gfc_dep_compare_expr (a1->start[i], a2->start[i]) != 0)
Index: gcc/testsuite/gfortran.dg/pr78279.f90
===================================================================
--- gcc/testsuite/gfortran.dg/pr78279.f90 (nonexistent)
+++ gcc/testsuite/gfortran.dg/pr78279.f90 (working copy)
@@ -0,0 +1,10 @@
+! { dg-do compile }
+! { dg-options "-Ofast" }
+program p
+ integer :: i
+ real :: z(2,4)
+ z = 0.0
+ do i = 1, 3
+ if ( z(i) > z(1,i+1) ) print *, i ! { dg-error "mismatch in array reference" }
+ end do
+end