From 47feeb36526b106053ad8d4fc7a64c23ce16f5de Mon Sep 17 00:00:00 2001 From: "Steven G. Kargl" Date: Tue, 12 Jun 2018 17:55:24 +0000 Subject: [PATCH] re PR fortran/44491 (Diagnostic just shows "" instead of a locus) 2018-06-12 Steven G. Kargl PR fortran/44491 * expr.c (gfc_check_assign): Select non-NULL locus. 2018-06-12 Steven G. Kargl PR fortran/44491 * gfortran.dg/pr44491.f90: New testcase From-SVN: r261516 --- gcc/fortran/ChangeLog | 5 +++++ gcc/fortran/expr.c | 5 ++++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/pr44491.f90 | 5 +++++ 4 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gfortran.dg/pr44491.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 8a0b5ac6264..46498a30c7f 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2018-06-12 Steven G. Kargl + + PR fortran/44491 + * expr.c (gfc_check_assign): Select non-NULL locus. + 2018-06-11 Janus Weil PR fortran/45521 diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index e6ab82272f1..a1336d27859 100644 --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -3414,6 +3414,8 @@ gfc_check_assign (gfc_expr *lvalue, gfc_expr *rvalue, int conform, /* Only DATA Statements come here. */ if (!conform) { + locus *where; + /* Numeric can be converted to any other numeric. And Hollerith can be converted to any other type. */ if ((gfc_numeric_ts (&lvalue->ts) && gfc_numeric_ts (&rvalue->ts)) @@ -3423,8 +3425,9 @@ gfc_check_assign (gfc_expr *lvalue, gfc_expr *rvalue, int conform, if (lvalue->ts.type == BT_LOGICAL && rvalue->ts.type == BT_LOGICAL) return true; + where = lvalue->where.lb ? &lvalue->where : &rvalue->where; gfc_error ("Incompatible types in DATA statement at %L; attempted " - "conversion of %s to %s", &lvalue->where, + "conversion of %s to %s", where, gfc_typename (&rvalue->ts), gfc_typename (&lvalue->ts)); return false; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f9c8d93d3d3..f009f2b4768 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-06-12 Steven G. Kargl + + PR fortran/44491 + * gfortran.dg/pr44491.f90: New testcase + 2018-06-12 Martin Sebor PR c/85931 diff --git a/gcc/testsuite/gfortran.dg/pr44491.f90 b/gcc/testsuite/gfortran.dg/pr44491.f90 new file mode 100644 index 00000000000..406bb262f71 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr44491.f90 @@ -0,0 +1,5 @@ +! { dg-do compile } +! { dg-options "-std=gnu" } +! PR fortran/44491 + character*2 escape /z'1B'/ ! { dg-error "Incompatible types in DATA" } + end -- 2.30.2