re PR fortran/29051 (segfault when too few values are in data statement of character array)

2006-09-15  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/29051
	* decl.c (match_old_style_init): Set the 'where' field of the
	gfc_data structure 'newdata'.

	* match.c (match_case_eos): Add a comprehensible error message.

2006-09-15  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/29051
	* gfortran.dg/oldstyle_3.f90: New test.

From-SVN: r116977
This commit is contained in:
Paul Thomas 2006-09-15 16:30:52 +00:00
parent 906d8c784a
commit 8c5c0b80a4
5 changed files with 28 additions and 1 deletions

View File

@ -1,3 +1,11 @@
2006-09-15 Paul Thomas <pault@gcc.gnu.org>
PR fortran/29051
* decl.c (match_old_style_init): Set the 'where' field of the
gfc_data structure 'newdata'.
* match.c (match_case_eos): Add a comprehensible error message.
2006-09-13 Wolfgang Gellerich <gellerich@de.ibm.com>
* trans-expr.c (gfc_add_interface_mapping): For characters, dereference

View File

@ -395,6 +395,7 @@ match_old_style_init (const char *name)
newdata = gfc_get_data ();
newdata->var = gfc_get_data_variable ();
newdata->var->expr = gfc_get_variable_expr (st);
newdata->where = gfc_current_locus;
/* Match initial value list. This also eats the terminal
'/'. */

View File

@ -3056,7 +3056,10 @@ match_case_eos (void)
/* If the case construct doesn't have a case-construct-name, we
should have matched the EOS. */
if (!gfc_current_block ())
return MATCH_ERROR;
{
gfc_error ("Expected the name of the select case construct at %C");
return MATCH_ERROR;
}
gfc_gobble_whitespace ();

View File

@ -1,3 +1,8 @@
2006-09-15 Paul Thomas <pault@gcc.gnu.org>
PR fortran/29051
* gfortran.dg/oldstyle_3.f90: New test.
2006-09-15 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/29099

View File

@ -0,0 +1,10 @@
! { dg-do compile }
! Suppress the warning about an old-style initializer;
! { dg-options "" }
! This tests the fix for PR29052 in which the error below would cause a seg-fault
! because the locus of the initializer was never set.
!
! Contributed by Bud Davis <bdavis@gcc.gnu.org>
!
character*10 a(4,2) /'aaa','bbb','ccc','ddd'/ ! { dg-error "more variables than values" }
end