[multiple changes]

2016-07-28  Steven G. Kargl  <kargl@gcc.gnu.org>
	    Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/71883
	* frontend-passes.c (gfc_run_passes): Bail out if there are any
	errors.
	* error.c (gfc_internal_error): If there are any errors in the
	buffer, exit with EXIT_FAILURE.

2016-07-28  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/71883
	* gfortran.dg/pr71883.f90 : New test.

From-SVN: r238822
This commit is contained in:
Paul Thomas 2016-07-28 14:47:02 +00:00
parent 63715e5e78
commit a23404c90f
5 changed files with 83 additions and 21 deletions

View File

@ -1,3 +1,12 @@
2016-07-28 Steven G. Kargl <kargl@gcc.gnu.org>
Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/71883
* frontend-passes.c (gfc_run_passes): Bail out if there are any
errors.
* error.c (gfc_internal_error): If there are any errors in the
buffer, exit with EXIT_FAILURE.
2016-07-28 Renlin Li <renlin.li@arm.com>
Revert

View File

@ -1303,10 +1303,15 @@ gfc_error (const char *gmsgid, ...)
void
gfc_internal_error (const char *gmsgid, ...)
{
int e, w;
va_list argp;
diagnostic_info diagnostic;
rich_location rich_loc (line_table, UNKNOWN_LOCATION);
gfc_get_errors (&w, &e);
if (e > 0)
exit(EXIT_FAILURE);
va_start (argp, gmsgid);
diagnostic_set_info (&diagnostic, gmsgid, &argp, &rich_loc, DK_ICE);
report_diagnostic (&diagnostic);

View File

@ -125,6 +125,7 @@ gfc_run_passes (gfc_namespace *ns)
doloop_level = 0;
doloop_warn (ns);
doloop_list.release ();
int w, e;
if (flag_frontend_optimize)
{
@ -136,6 +137,10 @@ gfc_run_passes (gfc_namespace *ns)
expr_array.release ();
}
gfc_get_errors (&w, &e);
if (e > 0)
return;
if (flag_realloc_lhs)
realloc_strings (ns);
}

View File

@ -1,3 +1,8 @@
2016-07-28 Paul Thomas <pault@gcc.gnu.org>
PR fortran/71883
* gfortran.dg/pr71883.f90 : New test.
2016-07-28 Yuri Rumyantsev <ysrumyan@gmail.com>
PR tree-optimization/71734

View File

@ -0,0 +1,38 @@
! { dg-do compile }
!
! Test the fix for pr71883, in which an ICE would follow the error.
!
! Contributed by Gerhard Steinmetz <gerhard.steinmetz.fortran@t-online.de>
!
program p
character(3), allocatable :: z(:,:)
z(1:2,1:2) = 'abc'
z(2,1) = z(12) ! { dg-error "Rank mismatch in array reference" }
z(21) = z(1,2) ! { dg-error "Rank mismatch in array reference" }
contains
subroutine a
character(3), allocatable :: z(:,:)
z(1:2,1:2) = 'abc'
z(2,1) = z(-1) ! { dg-error "Rank mismatch in array reference" }
z(2,1) = z(99) ! { dg-error "Rank mismatch in array reference" }
z(2,1) = z(huge(0)) ! { dg-error "Rank mismatch in array reference" }
z(2,1) = z(-huge(0)) ! { dg-error "Rank mismatch in array reference" }
z(-1) = z(2,1) ! { dg-error "Rank mismatch in array reference" }
z(99) = z(2,1) ! { dg-error "Rank mismatch in array reference" }
z(huge(0)) = z(2,1) ! { dg-error "Rank mismatch in array reference" }
z(-huge(0)) = z(2,1) ! { dg-error "Rank mismatch in array reference" }
end subroutine
subroutine b
character(:), allocatable :: z(:,:)
z(1:2,1:2) = 'abc'
z(2,1) = z(-1) ! { dg-error "Rank mismatch in array reference" }
z(2,1) = z(99) ! { dg-error "Rank mismatch in array reference" }
z(2,1) = z(huge(0)) ! { dg-error "Rank mismatch in array reference" }
z(2,1) = z(-huge(0)) ! { dg-error "Rank mismatch in array reference" }
z(-1) = z(2,1) ! { dg-error "Rank mismatch in array reference" }
z(99) = z(2,1) ! { dg-error "Rank mismatch in array reference" }
z(huge(0)) = z(2,1) ! { dg-error "Rank mismatch in array reference" }
z(-huge(0)) = z(2,1) ! { dg-error "Rank mismatch in array reference" }
end subroutine
end