Commit c4e3543d by Paul Thomas

re PR fortran/36371 (Wrong locus for errors in DATA statement)

2008-06-24  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/34371
	* expr.c (gfc_check_assign):  Change message and locus for
	error when conform == 0.

2008-06-24  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/36371
	* gfortran.dg/data_array_5.f90: New test.

From-SVN: r137088
parent 7b98a725
2008-06-24 Paul Thomas <pault@gcc.gnu.org>
PR fortran/34371
* expr.c (gfc_check_assign): Change message and locus for
error when conform == 0.
2008-06-23 Jakub Jelinek <jakub@redhat.com> 2008-06-23 Jakub Jelinek <jakub@redhat.com>
PR fortran/36597 PR fortran/36597
......
...@@ -2829,6 +2829,7 @@ gfc_check_assign (gfc_expr *lvalue, gfc_expr *rvalue, int conform) ...@@ -2829,6 +2829,7 @@ gfc_check_assign (gfc_expr *lvalue, gfc_expr *rvalue, int conform)
if (gfc_compare_types (&lvalue->ts, &rvalue->ts)) if (gfc_compare_types (&lvalue->ts, &rvalue->ts))
return SUCCESS; return SUCCESS;
/* Only DATA Statements come here. */
if (!conform) if (!conform)
{ {
/* Numeric can be converted to any other numeric. And Hollerith can be /* Numeric can be converted to any other numeric. And Hollerith can be
...@@ -2840,9 +2841,9 @@ gfc_check_assign (gfc_expr *lvalue, gfc_expr *rvalue, int conform) ...@@ -2840,9 +2841,9 @@ gfc_check_assign (gfc_expr *lvalue, gfc_expr *rvalue, int conform)
if (lvalue->ts.type == BT_LOGICAL && rvalue->ts.type == BT_LOGICAL) if (lvalue->ts.type == BT_LOGICAL && rvalue->ts.type == BT_LOGICAL)
return SUCCESS; return SUCCESS;
gfc_error ("Incompatible types in assignment at %L; attempted assignment " gfc_error ("Incompatible types in DATA statement at %L; attempted "
"of %s to %s", &rvalue->where, gfc_typename (&rvalue->ts), "conversion of %s to %s", &lvalue->where,
gfc_typename (&lvalue->ts)); gfc_typename (&rvalue->ts), gfc_typename (&lvalue->ts));
return FAILURE; return FAILURE;
} }
......
...@@ -2379,7 +2379,7 @@ check_intents (gfc_formal_arglist *f, gfc_actual_arglist *a) ...@@ -2379,7 +2379,7 @@ check_intents (gfc_formal_arglist *f, gfc_actual_arglist *a)
return FAILURE; return FAILURE;
} }
if (a->expr->symtree->n.sym->attr.pointer) if (f->sym->attr.pointer)
{ {
gfc_error ("Procedure argument at %L is local to a PURE " gfc_error ("Procedure argument at %L is local to a PURE "
"procedure and has the POINTER attribute", "procedure and has the POINTER attribute",
......
2008-06-24 Paul Thomas <pault@gcc.gnu.org>
PR fortran/36371
* gfortran.dg/data_array_5.f90: New test.
2008-06-24 Eric Botcazou <ebotcazou@adacore.com> 2008-06-24 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/warn5.adb: New test. * gnat.dg/warn5.adb: New test.
......
! { dg-do compile }
! Tests the fix for PR36371, in which the locus for the errors pointed to
! the paramter declaration rather than the data statement.
!
! Contributed by Dominique d'Humieres <dominiq@lps.ens.fr>
!
program chkdata
character(len=3), parameter :: mychar(3) = [ "abc", "def", "ghi" ]
integer, parameter :: myint(3) = [1, 2, 3]
integer :: c(2)
character(4) :: i(2)
data c / mychar(1), mychar(3) / ! { dg-error "Incompatible types in DATA" }
data i / myint(3), myint(2) / ! { dg-error "Incompatible types in DATA" }
end program chkdata
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