[gfortran] Fix PR 16579: Signed/Unsigned confusion in ICHAR
Tobias Schlüter
tobias.schlueter@physik.uni-muenchen.de
Tue Aug 31 22:40:00 GMT 2004
Tobias Schlüter wrote:
> Default character is a signed type. This is 50% of the problem in
> gfc_trans_intrinsic_ichar. Should we change this to an unsigned type? It seems
> to make sense. With the signed type in place I had to insert an explicit
> conversion to unsigned char in our implementation of ICHAR.
Actually, that amounts to 100% of the problem as I verified by changing
gfc_character1_type_node to an unsigned type. Instead of my previous patch, I
propose the appended one-line fix.
Built and tested, this also fixes the testcase I sent in my original mail. Ok?
- Tobi
2004-08-31 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
PR fortran/16579
* trans-types.c (gfc_init_types): Make gfc_character1_type_node an
unsigned char.
Index: trans-types.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/trans-types.c,v
retrieving revision 1.24
diff -u -p -r1.24 trans-types.c
--- trans-types.c 31 Aug 2004 16:52:38 -0000 1.24
+++ trans-types.c 31 Aug 2004 21:30:55 -0000
@@ -501,7 +501,8 @@ gfc_init_types (void)
PUSH_TYPE (name_buf, type);
}
- gfc_character1_type_node = build_type_variant (signed_char_type_node, 0, 0);
+ gfc_character1_type_node = build_type_variant (unsigned_char_type_node,
+ 0, 0);
PUSH_TYPE ("char", gfc_character1_type_node);
PUSH_TYPE ("byte", unsigned_char_type_node);
More information about the Gcc-patches
mailing list