re PR fortran/69544 (Internal compiler error with -Wall and where)
authorThomas Koenig <tkoenig@gcc.gnu.org>
Tue, 1 Nov 2016 16:18:18 +0000 (16:18 +0000)
committerThomas Koenig <tkoenig@gcc.gnu.org>
Tue, 1 Nov 2016 16:18:18 +0000 (16:18 +0000)
2016-11-01  Thomas Koenig  <tkoenig@gcc.gnu.org>

PR fortran/69544
* match.c (gfc_match_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_5.f90:  New test.

From-SVN: r241745

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

index d3120e59fdf3d7c78ddec463931582b95f06a51b..b3a0d50dc60489800e448daee27798971d36d3ca 100644 (file)
@@ -1,3 +1,9 @@
+2016-11-01  Thomas Koenig  <tkoenig@gcc.gnu.org>
+
+       PR fortran/69544
+       * match.c (gfc_match_where):  Fill in locus for assigment
+       in simple WHERE statement.
+
 2016-10-31  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
 
        PR fortran/54679
index 0996a9efae6f1b522011cb6de95aab9515ef82e4..5ec6e895451920d31f095b9a479e0e31800568c7 100644 (file)
@@ -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;
index 3d49662d84e7131b8dda35695c6f2957fe346f1d..64cfc539a5d47a7c4e83a8d71fb496ac84509393 100644 (file)
@@ -1,3 +1,8 @@
+2016-11-01  Thomas Koenig  <tkoenig@gcc.gnu.org>
+
+       PR fortran/69544
+       * gfortran.dg/where_5.f90:  New test.
+
 2016-11-01  Bilyan Borisov  <bilyan.borisov@arm.com>
 
        * 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 (file)
index 0000000..5ada63d
--- /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)
+  where (txt(1:3) /= ''   )  y(1:3,i,j) = txt(1:3) ! { dg-warning "CHARACTER expression will be truncated" }
+
+end subroutine where_ice