Commit a23404c9 by Paul Thomas

[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
parent 63715e5e
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> 2016-07-28 Renlin Li <renlin.li@arm.com>
Revert Revert
...@@ -19,7 +28,7 @@ ...@@ -19,7 +28,7 @@
2016-07-22 Steven G. Kargl <kargl@gcc.gnu.org> 2016-07-22 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/71935 PR fortran/71935
* check.c (is_c_interoperable): Simplify right expression. * check.c (is_c_interoperable): Simplify right expression.
2016-07-22 Thomas Koenig <tkoenig@gcc.gnu.org> 2016-07-22 Thomas Koenig <tkoenig@gcc.gnu.org>
...@@ -75,7 +84,7 @@ ...@@ -75,7 +84,7 @@
PR fortran/29819 PR fortran/29819
* parse.c (parse_contained): Use proper locus. * parse.c (parse_contained): Use proper locus.
2016-07-14 Andre Vehreschild <vehre@gcc.gnu.org> 2016-07-14 Andre Vehreschild <vehre@gcc.gnu.org>
PR fortran/70842 PR fortran/70842
......
...@@ -307,7 +307,7 @@ show_locus (locus *loc, int c1, int c2) ...@@ -307,7 +307,7 @@ show_locus (locus *loc, int c1, int c2)
error_string (f->filename); error_string (f->filename);
error_char (':'); error_char (':');
error_integer (LOCATION_LINE (lb->location)); error_integer (LOCATION_LINE (lb->location));
if ((c1 > 0) || (c2 > 0)) if ((c1 > 0) || (c2 > 0))
...@@ -357,7 +357,7 @@ show_locus (locus *loc, int c1, int c2) ...@@ -357,7 +357,7 @@ show_locus (locus *loc, int c1, int c2)
offset = cmax - terminal_width + 5; offset = cmax - terminal_width + 5;
/* Show the line itself, taking care not to print more than what can /* Show the line itself, taking care not to print more than what can
show up on the terminal. Tabs are converted to spaces, and show up on the terminal. Tabs are converted to spaces, and
nonprintable characters are converted to a "\xNN" sequence. */ nonprintable characters are converted to a "\xNN" sequence. */
p = &(lb->line[offset]); p = &(lb->line[offset]);
...@@ -375,7 +375,7 @@ show_locus (locus *loc, int c1, int c2) ...@@ -375,7 +375,7 @@ show_locus (locus *loc, int c1, int c2)
error_char ('\n'); error_char ('\n');
/* Show the '1' and/or '2' corresponding to the column of the error /* Show the '1' and/or '2' corresponding to the column of the error
locus. Note that a value of -1 for c1 or c2 will simply cause locus. Note that a value of -1 for c1 or c2 will simply cause
the relevant number not to be printed. */ the relevant number not to be printed. */
c1 -= offset; c1 -= offset;
...@@ -440,7 +440,7 @@ show_loci (locus *l1, locus *l2) ...@@ -440,7 +440,7 @@ show_loci (locus *l1, locus *l2)
else else
m = c1 - c2; m = c1 - c2;
/* Note that the margin value of 10 here needs to be less than the /* Note that the margin value of 10 here needs to be less than the
margin of 5 used in the calculation of offset in show_locus. */ margin of 5 used in the calculation of offset in show_locus. */
if (l1->lb != l2->lb || m > terminal_width - 10) if (l1->lb != l2->lb || m > terminal_width - 10)
...@@ -467,11 +467,11 @@ show_loci (locus *l1, locus *l2) ...@@ -467,11 +467,11 @@ show_loci (locus *l1, locus *l2)
If a locus pointer is given, the actual source line is printed out If a locus pointer is given, the actual source line is printed out
and the column is indicated. Since we want the error message at and the column is indicated. Since we want the error message at
the bottom of any source file information, we must scan the the bottom of any source file information, we must scan the
argument list twice -- once to determine whether the loci are argument list twice -- once to determine whether the loci are
present and record this for printing, and once to print the error present and record this for printing, and once to print the error
message after and loci have been printed. A maximum of two locus message after and loci have been printed. A maximum of two locus
arguments are permitted. arguments are permitted.
This function is also called (recursively) by show_locus in the This function is also called (recursively) by show_locus in the
case of included files; however, as show_locus does not resupply case of included files; however, as show_locus does not resupply
any loci, the recursion is at most one level deep. */ any loci, the recursion is at most one level deep. */
...@@ -687,11 +687,11 @@ error_print (const char *type, const char *format0, va_list argp) ...@@ -687,11 +687,11 @@ error_print (const char *type, const char *format0, va_list argp)
/* This is a position specifier. See comment above. */ /* This is a position specifier. See comment above. */
while (ISDIGIT (*format)) while (ISDIGIT (*format))
format++; format++;
/* Skip over the dollar sign. */ /* Skip over the dollar sign. */
format++; format++;
} }
switch (*format) switch (*format)
{ {
case '%': case '%':
...@@ -804,10 +804,10 @@ gfc_warning (int opt, const char *gmsgid, va_list ap) ...@@ -804,10 +804,10 @@ gfc_warning (int opt, const char *gmsgid, va_list ap)
++werrorcount; ++werrorcount;
else if (diagnostic.kind == DK_ERROR) else if (diagnostic.kind == DK_ERROR)
++werrorcount_buffered; ++werrorcount_buffered;
else else
++werrorcount, --warningcount, ++warningcount_buffered; ++werrorcount, --warningcount, ++warningcount_buffered;
} }
va_end (argp); va_end (argp);
return ret; return ret;
} }
...@@ -1030,17 +1030,17 @@ gfc_diagnostic_build_locus_prefix (diagnostic_context *context, ...@@ -1030,17 +1030,17 @@ gfc_diagnostic_build_locus_prefix (diagnostic_context *context,
With -fdiagnostic-show-caret (the default) it prints: With -fdiagnostic-show-caret (the default) it prints:
[locus of primary range]: [locus of primary range]:
some code some code
1 1
Error: Some error at (1) Error: Some error at (1)
With -fno-diagnostic-show-caret or if the primary range is not With -fno-diagnostic-show-caret or if the primary range is not
valid, it prints: valid, it prints:
[locus of primary range]: Error: Some error at (1) and (2) [locus of primary range]: Error: Some error at (1) and (2)
*/ */
static void static void
gfc_diagnostic_starter (diagnostic_context *context, gfc_diagnostic_starter (diagnostic_context *context,
diagnostic_info *diagnostic) diagnostic_info *diagnostic)
{ {
...@@ -1051,7 +1051,7 @@ gfc_diagnostic_starter (diagnostic_context *context, ...@@ -1051,7 +1051,7 @@ gfc_diagnostic_starter (diagnostic_context *context,
bool one_locus = diagnostic->richloc->get_num_locations () < 2; bool one_locus = diagnostic->richloc->get_num_locations () < 2;
bool same_locus = false; bool same_locus = false;
if (!one_locus) if (!one_locus)
{ {
s2 = diagnostic_expand_location (diagnostic, 1); s2 = diagnostic_expand_location (diagnostic, 1);
same_locus = diagnostic_same_line (context, s1, s2); same_locus = diagnostic_same_line (context, s1, s2);
...@@ -1223,8 +1223,8 @@ gfc_warning_check (void) ...@@ -1223,8 +1223,8 @@ gfc_warning_check (void)
werrorcount += werrorcount_buffered; werrorcount += werrorcount_buffered;
gcc_assert (warningcount_buffered + werrorcount_buffered == 1); gcc_assert (warningcount_buffered + werrorcount_buffered == 1);
pp->buffer = tmp_buffer; pp->buffer = tmp_buffer;
diagnostic_action_after_output (global_dc, diagnostic_action_after_output (global_dc,
warningcount_buffered warningcount_buffered
? DK_WARNING : DK_ERROR); ? DK_WARNING : DK_ERROR);
} }
} }
...@@ -1303,10 +1303,15 @@ gfc_error (const char *gmsgid, ...) ...@@ -1303,10 +1303,15 @@ gfc_error (const char *gmsgid, ...)
void void
gfc_internal_error (const char *gmsgid, ...) gfc_internal_error (const char *gmsgid, ...)
{ {
int e, w;
va_list argp; va_list argp;
diagnostic_info diagnostic; diagnostic_info diagnostic;
rich_location rich_loc (line_table, UNKNOWN_LOCATION); rich_location rich_loc (line_table, UNKNOWN_LOCATION);
gfc_get_errors (&w, &e);
if (e > 0)
exit(EXIT_FAILURE);
va_start (argp, gmsgid); va_start (argp, gmsgid);
diagnostic_set_info (&diagnostic, gmsgid, &argp, &rich_loc, DK_ICE); diagnostic_set_info (&diagnostic, gmsgid, &argp, &rich_loc, DK_ICE);
report_diagnostic (&diagnostic); report_diagnostic (&diagnostic);
...@@ -1332,7 +1337,7 @@ gfc_clear_error (void) ...@@ -1332,7 +1337,7 @@ gfc_clear_error (void)
bool bool
gfc_error_flag_test (void) gfc_error_flag_test (void)
{ {
return error_buffer.flag return error_buffer.flag
|| !gfc_output_buffer_empty_p (pp_error_buffer); || !gfc_output_buffer_empty_p (pp_error_buffer);
} }
......
...@@ -125,6 +125,7 @@ gfc_run_passes (gfc_namespace *ns) ...@@ -125,6 +125,7 @@ gfc_run_passes (gfc_namespace *ns)
doloop_level = 0; doloop_level = 0;
doloop_warn (ns); doloop_warn (ns);
doloop_list.release (); doloop_list.release ();
int w, e;
if (flag_frontend_optimize) if (flag_frontend_optimize)
{ {
...@@ -136,6 +137,10 @@ gfc_run_passes (gfc_namespace *ns) ...@@ -136,6 +137,10 @@ gfc_run_passes (gfc_namespace *ns)
expr_array.release (); expr_array.release ();
} }
gfc_get_errors (&w, &e);
if (e > 0)
return;
if (flag_realloc_lhs) if (flag_realloc_lhs)
realloc_strings (ns); realloc_strings (ns);
} }
......
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> 2016-07-28 Yuri Rumyantsev <ysrumyan@gmail.com>
PR tree-optimization/71734 PR tree-optimization/71734
...@@ -43,7 +48,7 @@ ...@@ -43,7 +48,7 @@
2016-07-27 Senthil Kumar Selvaraj <senthil_kumar.selvaraj@atmel.com> 2016-07-27 Senthil Kumar Selvaraj <senthil_kumar.selvaraj@atmel.com>
* gcc.dg/torture/pr69352.c: Use __INTPTR_TYPE__ instead of * gcc.dg/torture/pr69352.c: Use __INTPTR_TYPE__ instead of
including stdint.h. including stdint.h.
* gcc.dg/torture/pr71866.c: Use __UINTPTR_TYPE__ isntead of * gcc.dg/torture/pr71866.c: Use __UINTPTR_TYPE__ isntead of
including stdint.h. including stdint.h.
...@@ -378,7 +383,7 @@ ...@@ -378,7 +383,7 @@
2016-07-19 Senthil Kumar Selvaraj <senthil_kumar.selvaraj@atmel.com> 2016-07-19 Senthil Kumar Selvaraj <senthil_kumar.selvaraj@atmel.com>
* gcc.dg/params/blocksort-part.c: Conditionally define Int32 * gcc.dg/params/blocksort-part.c: Conditionally define Int32
and UInt32 based on __SIZEOF_INT__. and UInt32 based on __SIZEOF_INT__.
2016-07-19 Richard Biener <rguenther@suse.de> 2016-07-19 Richard Biener <rguenther@suse.de>
......
! { 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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment