re PR fortran/78178 (ICE in WHERE statement with diagnostic)
authorThomas Koenig <tkoenig@gcc.gnu.org>
Tue, 1 Nov 2016 21:16:46 +0000 (21:16 +0000)
committerThomas Koenig <tkoenig@gcc.gnu.org>
Tue, 1 Nov 2016 21:16:46 +0000 (21:16 +0000)
2016-11-01  Thomas Koenig  <tkoenig@gcc.gnu.org>

PR fortran/78178
* match.c (match_simple_where):  Fill in locus for assigment
in simple WHERE statement.

2016-11-01  Thomas Koenig  <tkoenig@gcc.gnu.org>

PR fortran/69544
* gfortran.dg/where_6.f90:  New test.

From-SVN: r241756

gcc/fortran/ChangeLog
gcc/fortran/match.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/where_6.f90 [new file with mode: 0644]

index b3a0d50dc60489800e448daee27798971d36d3ca..fd51989e402ad48639b98c79afcd4c8c29dc605d 100644 (file)
@@ -1,3 +1,9 @@
+2016-11-01  Thomas Koenig  <tkoenig@gcc.gnu.org>
+
+       PR fortran/78178
+       * match.c (match_simple_where):  Fill in locus for assigment
+       in simple WHERE statement.
+
 2016-11-01  Thomas Koenig  <tkoenig@gcc.gnu.org>
 
        PR fortran/69544
index 5ec6e895451920d31f095b9a479e0e31800568c7..40566f64a2841969a97b449f245e59be7cc253ac 100644 (file)
@@ -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;
index 7572f864606ae0c5ddbbc32fbb388c4ff0658b95..57bf83db2a09825edf365513aaab114d932c3554 100644 (file)
@@ -1,3 +1,8 @@
+2016-11-01  Thomas Koenig  <tkoenig@gcc.gnu.org>
+
+       PR fortran/69544
+       * gfortran.dg/where_6.f90:  New test.
+
 2016-11-01  Jakub Jelinek  <jakub@redhat.com>
 
        * 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 (file)
index 0000000..c7c43db
--- /dev/null
@@ -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