https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82700
Bug ID: 82700 Summary: ICE in printf-return-value with -fexec-charset=EBCDIC-US: converting to execution character set: Invalid or incomplete multibyte or wide character Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: msebor at gcc dot gnu.org Target Milestone: --- The following ICE came up in a discussion Re: [RFC] New pragma exec_charset (https://gcc.gnu.org/ml/gcc-patches/2017-10/msg01672.html). The program is expected to compile with the same output as with -fexec-charset=IBM1047. $ cat c.c && gcc -Wall -O2 -fexec-charset=EBCDIC-US c.c int main (void) { char d[5]; int n = __builtin_sprintf (d, "i=%i", 12345); if (n != 7) __builtin_abort (); } c.c: In function ‘main’: c.c:5:34: warning: too many arguments for format [-Wformat-extra-args] int n = __builtin_sprintf (d, "i=%i", 12345); ^~~~~~ during GIMPLE pass: printf-return-value c.c:10:0: internal compiler error: converting to execution character set: Invalid or incomplete multibyte or wide character 0x82fe9f c_cpp_error(cpp_reader*, int, int, rich_location*, char const*, __va_list_tag (*) [1]) /ssd/src/gcc/svn/gcc/c-family/c-common.c:6075 0x1905da0 cpp_diagnostic_at /ssd/src/gcc/svn/libcpp/errors.c:60 0x1905e72 cpp_diagnostic /ssd/src/gcc/svn/libcpp/errors.c:91 0x1905f27 cpp_error(cpp_reader*, int, char const*, ...) /ssd/src/gcc/svn/libcpp/errors.c:104 0x19067c0 cpp_errno(cpp_reader*, int, char const*) /ssd/src/gcc/svn/libcpp/errors.c:300 0x18fa3c6 cpp_host_to_exec_charset(cpp_reader*, unsigned int) /ssd/src/gcc/svn/libcpp/charset.c:798 0x82feeb c_common_to_target_charset(long) /ssd/src/gcc/svn/gcc/c-family/c-common.c:6093 0x17de7a9 init_target_to_host_charmap /ssd/src/gcc/svn/gcc/gimple-ssa-sprintf.c:319 0x17e68a8 execute /ssd/src/gcc/svn/gcc/gimple-ssa-sprintf.c:3990 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions.