------- Additional Comments From kghazi at verizon dot net 2004-12-07 20:08 ------- Subject: Re: [4.0 Regression] isdigit builtin function fails with EBCDIC character sets
> So it appears to me that the compiler builtin knows not to activate when the > -fexec-charset is invoked? No, there's no special -fexec-charset handling in the builtin printf either. What's happening here is that the trailing newline in "hello world\n" is not matching the '\n' in the test in builtins.c:expand_builtin_printf. This simply causes it to avoid doing the transformation into puts. Marginally suboptimal, but harmless. However, it will probably erroneously match the values for ASCII newline \012, as in "hello world\012", if that mapping appears by chance as the last character in your printf string. (I don't know what \012 maps to in IBM1047.) That would cause code to mistakenly change the call into puts with a string of length one less, adding the newline from puts. This no longer matches the intended behavior of the original program if '\n' in the source charset != '\n' in the exec charset. So I think whatever solution applies to isdigit should also be applied to printf (and perhaps elsewhere, I haven't done a full audit.) I'm not entirely sure how to fix it nor do I have the time to fully investigate at the moment, so some help would be appreciated. Thanks, --Kaveh -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18785