This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[Fortran, committed (branch and trunk)] Fix unsigned CHARACTER*1 regression.
- To: gcc-patches at gcc dot gnu dot org
- Subject: [Fortran, committed (branch and trunk)] Fix unsigned CHARACTER*1 regression.
- From: Toon Moene <toon at moene dot indiv dot nluug dot nl>
- Date: Sat, 02 Jun 2001 17:42:51 +0200
- Organization: Moene Computational Physics, Maartensdijk, The Netherlands
L.S.,
Jakub Jelinek pointed out to me that
program test
integer ic
character*1 ch
ch=char(255)
ic=ichar(ch)
print *,ic
end
prints `-1' with the current branch and trunk, whereas it printed `225'
with gcc/g77-2.95.3 and earlier.
Foregoing a philosophical discussion about what g77 is required to do
here according to the relevant Standard(s), I've committed the following
patch to branch and trunk to restore previous behaviour:
2001-06-02 Toon Moene <toon@moene.indiv.nluug.nl>
* com.c (ffecom_init_0): Make CHARACTER*1 unsigned.
*** com.c.orig Fri Jun 1 19:39:23 2001
--- com.c Sat Jun 2 16:21:03 2001
*************** ffecom_init_0 ()
*** 11474,11477 ****
--- 11474,11479 ----
pushdecl (build_decl (TYPE_DECL, get_identifier ("int"),
integer_type_node));
+ /* CHARACTER*1 is unsigned in ICHAR contexts. */
+ char_type_node = make_unsigned_type (CHAR_TYPE_SIZE);
pushdecl (build_decl (TYPE_DECL, get_identifier ("char"),
char_type_node));
Bootstrapped and checked (C and Fortran only) on i686-pc-linux-gnu.
--
Toon Moene - mailto:toon@moene.indiv.nluug.nl - phoneto: +31 346 214290
Saturnushof 14, 3738 XG Maartensdijk, The Netherlands
Maintainer, GNU Fortran 77: http://gcc.gnu.org/onlinedocs/g77_news.html
Join GNU Fortran 95: http://g95.sourceforge.net/ (under construction)