This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [patch, fortran] Wide character I/O Part 1
- From: FX <fxcoudert at gmail dot com>
- To: Tobias Burnus <burnus at net-b dot de>
- Cc: Jerry DeLisle <jvdelisle at verizon dot net>, Fortran List <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 29 May 2008 21:55:01 +0100
- Subject: Re: [patch, fortran] Wide character I/O Part 1
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:in-reply-to:references:mime-version:content-type:message-id:cc:content-transfer-encoding:from:subject:date:to:x-mailer; bh=HloIESJ4V/JaWUtmDfgtsZq4T6iG95dWAY+tbcNRGLY=; b=SCkudVXY4Om0nnrZj/JdWI9kM4uuisJsOVAe/F14SkCpBO0jhzdLliWXJihE3RJoolQVsm/oEuupnpYwZCv34pITWTuUxX6F/xPhcGBoV+2QohNtgGIYbdLwfBlJCG6Y3ZLteEwITrYc9onQ22w9EswRvCowCCk76yJ7M38LkAM=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=in-reply-to:references:mime-version:content-type:message-id:cc:content-transfer-encoding:from:subject:date:to:x-mailer; b=gtfMnTz7rsf5a8BybAEUS2CtdDB2pC6jU03biKtePgyxDI+e0TLTLE98nt11QutA/cWxLGwmynZ1b2cxnggMZ3w24arO/0Vjc3Euwk+AHT4K5Pxz+iII9eBjDH1hdCYf7NZFtpLmiNIAQvliLEKma/Fu/2N0P5i4ES7XbwMknFE=
- References: <483E0FBE.8090301@verizon.net> <483EFC3E.2070102@net-b.de>
In principle I had expected that the following does so, but my
tests fail:
+ *p++ = (unsigned int) source[i * kind] > 255 ?
+ '?' : source[i * kind + endian_off];
I'd say you have to convert to (unsigned char) instead of (unsigned
int):
$ cat a.c
int main(void) {
char c = '\xAE';
__builtin_printf ("%u\n", (unsigned int) c);
__builtin_printf ("%u\n", (unsigned int) (unsigned char) c);
}
$ gcc a.c && ./a.out
4294967214
174
I think that your next patch can then also enable selected_char_kind
('ISO 10646') (see gfc_simplify_selected_char_kind).
Agreed. We should also remember to modify the library version of that
intrinsic.
Looks OK. Thanks for the patch.
Jerry, if you can hold it one more hour, I'm reviewing it and I have
some (minor) comments.
FX
--
François-Xavier Coudert
http://www.homepages.ucl.ac.uk/~uccafco/