From 7f4266d4fdfc7442d11d2c1a5f8c956a577e0813 Mon Sep 17 00:00:00 2001 From: Thomas Koenig Date: Tue, 1 Nov 2016 16:18:18 +0000 Subject: [PATCH] re PR fortran/69544 (Internal compiler error with -Wall and where) 2016-11-01 Thomas Koenig PR fortran/69544 * match.c (gfc_match_where): Fill in locus for assigment in simple WHERE statement. 2016-11-01 Thomas Koenig PR fortran/69544 * gfortran.dg/where_5.f90: New test. From-SVN: r241745 --- gcc/fortran/ChangeLog | 6 ++++++ gcc/fortran/match.c | 4 ++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/where_5.f90 | 15 +++++++++++++++ 4 files changed, 30 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/where_5.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index d3120e59fdf..b3a0d50dc60 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2016-11-01 Thomas Koenig + + PR fortran/69544 + * match.c (gfc_match_where): Fill in locus for assigment + in simple WHERE statement. + 2016-10-31 Jerry DeLisle PR fortran/54679 diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c index 0996a9efae6..5ec6e895451 100644 --- a/gcc/fortran/match.c +++ b/gcc/fortran/match.c @@ -6275,8 +6275,12 @@ gfc_match_where (gfc_statement *st) c = gfc_get_code (EXEC_WHERE); c->expr1 = expr; + /* Put in the assignment. It will not be processed by add_statement, so we + need to copy the location here. */ + 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 3d49662d84e..64cfc539a5d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-11-01 Thomas Koenig + + PR fortran/69544 + * gfortran.dg/where_5.f90: New test. + 2016-11-01 Bilyan Borisov * gcc.target/arm/simd/vmaxnm_f32_1.c: New. diff --git a/gcc/testsuite/gfortran.dg/where_5.f90 b/gcc/testsuite/gfortran.dg/where_5.f90 new file mode 100644 index 00000000000..5ada63d6a5d --- /dev/null +++ b/gcc/testsuite/gfortran.dg/where_5.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) + 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