Attached patch removes following warning:

libgfortran/io/transfer.c: In function ‘transfer_array_inner’:
libgfortran/io/transfer.c:2499:35: warning: operand of ?: changes
signedness from ‘long int’ to ‘size_t’ {aka ‘long unsigned int’} due
to unsignedness of other operand [-Wsign-compare]

There is actually no need to cast "charlen" to (unsigned) index_type,
as it is already declared as size_t:

typedef size_t gfc_charlen_type;

the same type as are "elem_len" and "size" variables.

2019-02-26  Uroš Bizjak  <ubiz...@gmail.com>

    * io/transfer.c (transfer_array_inner): Do not
    cast charlen to index type.

Patch was bootstrapped and regression tested on x86_64-linux-gnu {,-m32}.

OK for mainline?

Uros.
Index: io/transfer.c
===================================================================
--- io/transfer.c       (revision 269217)
+++ io/transfer.c       (working copy)
@@ -2496,7 +2496,7 @@ transfer_array_inner (st_parameter_dt *dtp, gfc_ar
     return;
 
   iotype = (bt) GFC_DESCRIPTOR_TYPE (desc);
-  size = iotype == BT_CHARACTER ? (index_type) charlen : GFC_DESCRIPTOR_SIZE 
(desc);
+  size = iotype == BT_CHARACTER ? charlen : GFC_DESCRIPTOR_SIZE (desc);
 
   rank = GFC_DESCRIPTOR_RANK (desc);
 

Reply via email to