-finput-charset internal error
杨继超
jcyangzh@gmail.com
Sun Apr 8 03:26:00 GMT 2012
Hi, all.
I have a internal error while compiling the follow soure code with command:
gcc gbk.c -finput-charset=gbk -fexec-charset=utf-16 -o gbk
#include <wchar.h>
#include <stdio.h>
void output_hex(const char *p, int len);
int main()
{
const char c_test[] = "I爱你";
const wchar_t wc_test[] = L"I爱你";
output_hex(c_test, sizeof(c_test));
output_hex((const char*)wc_test, sizeof(wc_test));
}
void output_hex(const char* p, int len)
{
int i;
for ( i = 0; i < len; i++) {
unsigned char ch = (unsigned char)p[i];
printf("%02X ", ch);
}
printf("\n");
}
The error message is
jcyangzh@debian:~/src/
encoding/compiler$ gcc -finput-charset=gbk gbk.c -fexec-charset=utf-16
gbk.c:10:1: internal error: character 0xa is not unibyte in execution
character set
gbk.c:10:1: internal error: character 0x25 is not unibyte in execution
character set
gbk.c:10:1: internal error: character 0x63 is not unibyte in execution
character set
gbk.c:10:1: internal error: character 0x73 is not unibyte in execution
character set
gbk.c:10:1: internal error: character 0xa is not unibyte in execution
character set
gbk.c:10:1: internal error: character 0x25 is not unibyte in execution
character set
gbk.c:10:1: internal error: character 0x63 is not unibyte in execution
character set
gbk.c:10:1: internal error: character 0x73 is not unibyte in execution
character set
The encoding of source file is gbk.But when i set the fexec-charset to
utf-8, the compiler works well.
Thanks.
More information about the Gcc-help
mailing list