[Bug libfortran/22423] Warnings when building libgfortran
fxcoudert at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Sun May 3 16:29:00 GMT 2009
------- Comment #16 from fxcoudert at gcc dot gnu dot org 2009-05-03 16:28 -------
Many new warnings:
../../../trunk/libgfortran/runtime/string.c: In function Âcompare0Â:
../../../trunk/libgfortran/runtime/string.c:39: warning: comparison between
signed and unsigned integer expressions
Fixed by:
Index: runtime/string.c
===================================================================
--- runtime/string.c (revision 147057)
+++ runtime/string.c (working copy)
@@ -36,7 +36,10 @@
/* Strip trailing blanks from the Fortran string. */
len = fstrlen (s1, s1_len);
- if (len != strlen(s2)) return 0; /* don't match */
+
+ if ((size_t) len != strlen(s2))
+ return 0; /* don't match */
+
return strncasecmp (s1, s2, len) == 0;
}
../../../trunk/libgfortran/io/transfer.c: In function Âread_block_directÂ:
../../../trunk/libgfortran/io/transfer.c:468: warning: comparison between
signed and unsigned integer expressions
Fixed by:
Index: io/transfer.c
===================================================================
--- io/transfer.c (revision 147057)
+++ io/transfer.c (working copy)
@@ -465,7 +465,7 @@
/* Check whether we exceed the total record length. */
if (dtp->u.p.current_unit->flags.has_recl
- && (nbytes > dtp->u.p.current_unit->bytes_left))
+ && ((gfc_offset) nbytes > dtp->u.p.current_unit->bytes_left))
{
to_read_record = dtp->u.p.current_unit->bytes_left;
short_record = 1;
../../../trunk/libgfortran/io/list_read.c: In function Ânml_read_objÂ:
../../../trunk/libgfortran/io/list_read.c:2464: warning: comparison between
Âbt and Âenum <anonymous>Â
../../../trunk/libgfortran/io/list_read.c: In function Ânml_get_obj_dataÂ:
../../../trunk/libgfortran/io/list_read.c:2712: warning: comparison between
Âbt and Âenum <anonymous>Â
../../../trunk/libgfortran/io/list_read.c:2734: warning: comparison between
Âbt and Âenum <anonymous>Â
../../../trunk/libgfortran/io/list_read.c:2768: warning: comparison between
Âbt and Âenum <anonymous>Â
../../../trunk/libgfortran/io/write.c: In function Ânml_write_objÂ:
../../../trunk/libgfortran/io/write.c:1261: warning: comparison between ÂbtÂ
and Âenum <anonymous>Â
../../../trunk/libgfortran/io/write.c:1339: warning: comparison between ÂbtÂ
and Âenum <anonymous>Â
All these come from the use of two different enums for one purpose: the bt enum
in libgfortran/io/io.h and the anonymous enum containing GFC_DTYPE_UNKNOWN,
GFC_DTYPE_INTEGER and friends in gcc/fortran/libgfortran.h. I'm not sure at all
why there are two different enums, why their constants are sometimes used as if
they were interchangeable (all the warnings above come from such uses), but
what I know is that they shouldn't: the constants don't even come in the same
order!
Compare:
GFC_DTYPE_UNKNOWN = 0,
GFC_DTYPE_INTEGER,
GFC_DTYPE_LOGICAL,
GFC_DTYPE_REAL,
GFC_DTYPE_COMPLEX,
GFC_DTYPE_DERIVED,
GFC_DTYPE_CHARACTER
with
BT_NULL, /* ok, null and unknown are close enough */
BT_INTEGER,
BT_LOGICAL,
BT_CHARACTER, /* oops */
BT_REAL, /* re-oops */
BT_COMPLEX /* final oops */
/* and where is "derived"? */
--
fxcoudert at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed|2007-10-18 13:22:40 |2009-05-03 16:28:50
date| |
Version|4.0.2 |4.5.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22423
More information about the Gcc-bugs
mailing list