This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch, fortran] Wide character I/O Part 1


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]