From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4146 invoked by alias); 7 Dec 2004 20:08:51 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 4094 invoked by alias); 7 Dec 2004 20:08:45 -0000 Date: Tue, 07 Dec 2004 20:08:00 -0000 Message-ID: <20041207200845.4093.qmail@sourceware.org> From: "kghazi at verizon dot net" To: gcc-bugs@gcc.gnu.org In-Reply-To: <20041202142212.18785.darcypj@us.ibm.com> References: <20041202142212.18785.darcypj@us.ibm.com> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug middle-end/18785] [4.0 Regression] isdigit builtin function fails with EBCDIC character sets X-Bugzilla-Reason: CC X-SW-Source: 2004-12/txt/msg01054.txt.bz2 List-Id: ------- 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