2012-08-28  Tobias Burnus  <burnus@net-b.de>

	PR fortran/54382
	* error.c (show_locus): Avoid out of bound access.

diff --git a/gcc/fortran/error.c b/gcc/fortran/error.c
index dde6a0f..64b9357 100644
--- a/gcc/fortran/error.c
+++ b/gcc/fortran/error.c
@@ -384,6 +384,7 @@ show_locus (locus *loc, int c1, int c2)
 
   c1 -= offset;
   c2 -= offset;
+  cmax -= offset;
 
   p = &(lb->line[offset]);
   for (i = 0; i <= cmax; i++)
