From 5b7c051940e69046151e3094b56f1b13e873840e Mon Sep 17 00:00:00 2001 From: Thomas Koenig Date: Tue, 1 Nov 2016 21:16:46 +0000 Subject: [PATCH] re PR fortran/78178 (ICE in WHERE statement with diagnostic) 2016-11-01 Thomas Koenig PR fortran/78178 * match.c (match_simple_where): Fill in locus for assigment in simple WHERE statement. 2016-11-01 Thomas Koenig PR fortran/69544 * gfortran.dg/where_6.f90: New test. From-SVN: r241756 --- gcc/fortran/ChangeLog | 6 ++++++ gcc/fortran/match.c | 1 + gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/where_6.f90 | 15 +++++++++++++++ 4 files changed, 27 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/where_6.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index b3a0d50dc60..fd51989e402 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2016-11-01 Thomas Koenig + + PR fortran/78178 + * match.c (match_simple_where): Fill in locus for assigment + in simple WHERE statement. + 2016-11-01 Thomas Koenig PR fortran/69544 diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c index 5ec6e895451..40566f64a28 100644 --- a/gcc/fortran/match.c +++ b/gcc/fortran/match.c @@ -6219,6 +6219,7 @@ match_simple_where (void) c->next = XCNEW (gfc_code); *c->next = new_st; + c->next->loc = gfc_current_locus; gfc_clear_new_st (); new_st.op = EXEC_WHERE; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7572f864606..57bf83db2a0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-11-01 Thomas Koenig + + PR fortran/69544 + * gfortran.dg/where_6.f90: New test. + 2016-11-01 Jakub Jelinek * g++.dg/debug/dwarf2/inline-var-1.C: New test. diff --git a/gcc/testsuite/gfortran.dg/where_6.f90 b/gcc/testsuite/gfortran.dg/where_6.f90 new file mode 100644 index 00000000000..c7c43db8423 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/where_6.f90 @@ -0,0 +1,15 @@ +! { dg-do compile } +! { dg-options "-Wcharacter-truncation" } +subroutine where_ice (i,j) + + implicit none + + character(8) :: y(10,10,2) + + integer :: i + integer :: j + + character(12) :: txt(5) + if (.true.) where (txt(1:3) /= '' ) y(1:3,i,j) = txt(1:3) ! { dg-warning "CHARACTER expression will be truncated" } + +end subroutine where_ice -- 2.30.2