aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2008-06-24 21:44:28 +0000
committerPaul Thomas <pault@gcc.gnu.org>2008-06-24 21:44:28 +0000
commitc4e3543d047ac58fa0c989d036ce8f3bbc0392a7 (patch)
treea1a57d6d3298f726c1ff44a3519a0a4e32c92381 /gcc
parent7b98a7257e8957c74611788d9020d8cd613d7d89 (diff)
downloadgcc-c4e3543d047ac58fa0c989d036ce8f3bbc0392a7.zip
gcc-c4e3543d047ac58fa0c989d036ce8f3bbc0392a7.tar.gz
gcc-c4e3543d047ac58fa0c989d036ce8f3bbc0392a7.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/expr.c7
-rw-r--r--gcc/fortran/interface.c2
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/data_array_5.f9014
5 files changed, 30 insertions, 4 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index da1ac83..420218f 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,9 @@
+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>
PR fortran/36597
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c
index ace09de..2f7030e 100644
--- a/gcc/fortran/expr.c
+++ b/gcc/fortran/expr.c
@@ -2829,6 +2829,7 @@ gfc_check_assign (gfc_expr *lvalue, gfc_expr *rvalue, int conform)
if (gfc_compare_types (&lvalue->ts, &rvalue->ts))
return SUCCESS;
+ /* Only DATA Statements come here. */
if (!conform)
{
/* 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)
if (lvalue->ts.type == BT_LOGICAL && rvalue->ts.type == BT_LOGICAL)
return SUCCESS;
- gfc_error ("Incompatible types in assignment at %L; attempted assignment "
- "of %s to %s", &rvalue->where, gfc_typename (&rvalue->ts),
- gfc_typename (&lvalue->ts));
+ gfc_error ("Incompatible types in DATA statement at %L; attempted "
+ "conversion of %s to %s", &lvalue->where,
+ gfc_typename (&rvalue->ts), gfc_typename (&lvalue->ts));
return FAILURE;
}
diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c
index 724d662..26b4591 100644
--- a/gcc/fortran/interface.c
+++ b/gcc/fortran/interface.c
@@ -2379,7 +2379,7 @@ check_intents (gfc_formal_arglist *f, gfc_actual_arglist *a)
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 "
"procedure and has the POINTER attribute",
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 4c569c2..2c45e39 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+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>
* gnat.dg/warn5.adb: New test.
diff --git a/gcc/testsuite/gfortran.dg/data_array_5.f90 b/gcc/testsuite/gfortran.dg/data_array_5.f90
new file mode 100644
index 0000000..1d4e4e7
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/data_array_5.f90
@@ -0,0 +1,14 @@
+! { 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