PR libfortran/51828
authorfxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 18 Nov 2013 09:27:11 +0000 (09:27 +0000)
committerfxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 18 Nov 2013 09:27:11 +0000 (09:27 +0000)
* intrinsics/unpack_generic.c (unpack_internal): Let the compiler
know that dim > 0 to avoid warnings.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@204940 138bc75d-0d04-0410-961f-82ee72b054a4

libgfortran/ChangeLog
libgfortran/intrinsics/unpack_generic.c

index c18391f..fcbc548 100644 (file)
@@ -1,3 +1,9 @@
+2013-11-18  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
+
+       PR libfortran/51828
+       * intrinsics/unpack_generic.c (unpack_internal): Let the compiler
+       know that dim > 0 to avoid warnings.
+
 2013-11-15  Janne Blomqvist  <jb@gcc.gnu.org>
            Jerry DeLisle  <jvdelisle@gcc.gnu.org>
 
index d06e0a9..c57914f 100644 (file)
@@ -144,6 +144,9 @@ unpack_internal (gfc_array_char *ret, const gfc_array_char *vector,
   if (empty)
     return;
 
+  /* This assert makes sure GCC knows we can access *stride[0] later.  */
+  assert (dim > 0);
+
   vstride0 = GFC_DESCRIPTOR_STRIDE_BYTES(vector,0);
   rstride0 = rstride[0];
   fstride0 = fstride[0];