[Bug middle-end/18785] [4.0 Regression] isdigit builtin function fails with EBCDIC character sets

2004-12-07 Thread darcypj at us dot ibm dot com

--- Additional Comments From darcypj at us dot ibm dot com  2004-12-07 
15:21 ---
Wow - curiously, I don't have a problem with it, but that is because when I
added the -fexec-charset option, I no longer got the branch to puts().

Examples follow:

===
If I compile with the following options, I see the puts:

-c print.c -fverbose-asm -Wa,-aldhs=print.lst -gdwarf-2

   4:print.c      printf("Hello world\n");
  47.loc 1 4 0
  48 001c C020  larl%r2,.LC0#,
  48  
  49 0022 C0E5  brasl   %r14,puts   #,
  49  


===
And with these options (just the -fexec-charset addded) I see a call to 
printf().

-c print.c -fverbose-asm -Wa,-aldhs=print.lst -gdwarf-2 -fexec-charset=IBM1047

   4:print.c      printf("Hello world\n");
  47.loc 1 4 0
  48 001c C020  larl%r2,.LC0#,
  48  
  49 0022 C0E5  brasl   %r14,printf #,
  49  


Note, I get this warning either way since I am not including any headers, in
order to try and force the builtin printf()..

print.c: In function 'main':
print.c:4: warning: incompatible implicit declaration of built-in function 
'printf'

So it appears to me that the compiler builtin knows not to activate when the
-fexec-charset is invoked?

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18785


[Bug middle-end/18785] [4.0 Regression] isdigit builtin function fails with EBCDIC character sets

2004-12-02 Thread darcypj at us dot ibm dot com

--- Additional Comments From darcypj at us dot ibm dot com  2004-12-02 
15:27 ---
It appears it did use these macros in the ix86 example, I can obsolete that
attachment.

However, the s390x-ibm-tpf example does not use those macros.

I can attach a listing, since I doubt that you have this compiler built in
place, and it will be apparent that the builtin is behaving improperly,
comparing against ascii '0' even though the compiler is translating all
character literals into IBM1047.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18785


[Bug middle-end/18785] isdigit builtin function fails with EBCDIC character sets

2004-12-02 Thread darcypj at us dot ibm dot com

--- Additional Comments From darcypj at us dot ibm dot com  2004-12-02 
14:25 ---
Created an attachment (id=7657)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=7657&action=view)
s390x-ibm-tpf ".i" file as example.  COmpile command given in problem
statement.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18785


[Bug middle-end/18785] New: isdigit builtin function fails with EBCDIC character sets

2004-12-02 Thread darcypj at us dot ibm dot com
Configured with: /cteam/darcypj/200410bld/hbtree/configure
--target=s390x-ibm-tpf --prefix=/opt/tpf-cross-tools2
--with-gcc-version-trigger=/cteam/darcypj/200410bld/hbtree/gcc/version.c
--program-prefix=s390x-ibm-tpf-
--with-headers=/cteam/darcypj/200410bld/tpfheaders/include
--build=s390x-ibm-linux --without-newlib --enable-languages=c,c++
--with-libs=/opt/tpf-cross-tools2/lib --with-lib-path=/opt/tpf-cross-tools2/lib
--host=s390x-ibm-linux
Thread model: tpf
gcc version 4.0.0 20041107 (experimental)

Compilation command line:
s390x-ibm-tpf-gcc -c digit.c -fexec-charset=IBM1047 -fverbose-asm -gdwarf-2
-Wa,-aldhs=listing.lst --save-temps -Wall

No compiler warnings or errors emitted.

The isdigit builtin function is using ASCII '0' for the comparison to the
character passed to isdigit.  This causes a failure in this case, because the
IBM1047 codepage (and most EBCDIC based codepages) has a wholly different
representation for numeric characters than plain old ASCII.

Note: You don't need to be building for this specific target to get these
results, just use any version from the trunk after isdigit was inserted as a
builtin function, and make sure you use an EBCDIC character set for the
-fexec-charset.  I have .i files from s390x-ibm-tpf target and from a native
i686-gnu-linux build.

I will attach a sample .i file shortly from each architecture.

-- 
   Summary: isdigit builtin function fails with EBCDIC character
sets
   Product: gcc
   Version: 4.0.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: middle-end
AssignedTo: unassigned at gcc dot gnu dot org
    ReportedBy: darcypj at us dot ibm dot com
CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: s390x-ibm-linux
  GCC host triplet: s390x-ibm-linux
GCC target triplet: s390x-ibm-tpf


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18785