LTO compilation fails in the link time if o-files created with -funsigned-char but linking without. R174519 is the first commit when it was appeared. $ cat t_f.c char n[3] = {'a','b','c'}; int foo(char *x) { if (*x == 'y') return (int)*x; *x = 'y'; return 0; } $ cat t_m.c #include <stdio.h> extern int foo (char*); extern char n[3]; int main () { int i, m = 0; for (i = 0; i < 3; i++) m += foo(&n[i]); printf("%d\n", m); } $ gcc -c -m32 -O2 -flto t_f.c t_m.c -funsigned-char ; gcc -m32 -O2 -flto t_f.o t_m.o -o t0 In file included from :0:0: t_m.c: In function a€?maina€™: t_m.c:7:5: error: mismatching comparison operand types int main () ^ char unsigned char if (_14 == 121) t_m.c:7:5: internal compiler error: verify_gimple failed 0x98ab8b verify_gimple_in_cfg(function*) ../../gcc/gcc/tree-cfg.c:4728 0x8794d0 execute_function_todo ../../gcc/gcc/passes.c:1973 0x8787e9 do_per_function ../../gcc/gcc/passes.c:1705 0x8795f4 execute_todo ../../gcc/gcc/passes.c:2006 0x879a5e execute_one_ipa_transform_pass ../../gcc/gcc/passes.c:2183 0x879b42 execute_all_ipa_transforms() ../../gcc/gcc/passes.c:2213 0x5ae627 expand_function ../../gcc/gcc/cgraphunit.c:1615 0x5aeb00 expand_all_functions ../../gcc/gcc/cgraphunit.c:1726 0x5af58a compile() ../../gcc/gcc/cgraphunit.c:2024 0x512f39 lto_main() ../../gcc/gcc/lto/lto.c:3399 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <http://gcc.gnu.org/bugs.html> for instructions. lto-wrapper: gcc returned 1 exit status /bin/ld: lto-wrapper failed collect2: error: ld returned 1 exit status $ gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/export/users/vbyakovl/workspaces/gcc/install-ref/libexec/gcc/x86_64-unknown-linux-gnu/4.8.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: ../gcc/configure CFLAGS='-O0 -g3' --prefix=/export/users/vbyakovl/workspaces/gcc/install-ref --disable-bootstrap --enable-languages=c,c++,fortran,lto CXXFLAGS='-O0 -g3' Thread model: posix gcc version 4.8.0 20121105 (experimental) (GCC)
Confirmed. I'll have a looksee.
Ok, the issue is we preload char_type_node anyway, as show by Index: gcc/tree-streamer.c =================================================================== --- gcc/tree-streamer.c (revision 194444) +++ gcc/tree-streamer.c (working copy) @@ -237,6 +237,12 @@ streamer_tree_cache_lookup (struct strea static void record_common_node (struct streamer_tree_cache_d *cache, tree node) { + /* Verify we don't recursively pre-load nodes we do not want to preload. */ + gcc_assert (node != char_type_node + && node != boolean_type_node + && node != boolean_true_node + && node != boolean_false_node); + /* We have to make sure to fill exactly the same number of elements for all frontends. That can include NULL trees. As our hash table can't deal with zero entries we'll simply stream this is because we pre-load va_list_type_node (which is required, because we compare that by pointer equality). But the x86 backend (and possibly others) do: static tree ix86_build_builtin_va_list_abi (enum calling_abi abi) { tree f_gpr, f_fpr, f_ovf, f_sav, record, type_decl; /* For i386 we use plain pointer to argument area. */ if (!TARGET_64BIT || abi == MS_ABI) return build_pointer_type (char_type_node); oops.
Author: rguenth Date: Thu Dec 13 11:13:13 2012 New Revision: 194473 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=194473 Log: 2012-12-13 Richard Biener <rguenther@suse.de> PR lto/55660 * tree-streamer.c (record_common_node): Check that we are not recursively pre-loading nodes we want to skip. Handle char_type_node appearing as part of va_list_type_node. * gcc.dg/lto/pr55660_0.c: New testcase. * gcc.dg/lto/pr55660_1.c: Likewise. Added: trunk/gcc/testsuite/gcc.dg/lto/pr55660_0.c trunk/gcc/testsuite/gcc.dg/lto/pr55660_1.c Modified: trunk/gcc/ChangeLog trunk/gcc/testsuite/ChangeLog trunk/gcc/tree-streamer.c
Fixed on trunk sofar.
Author: rguenth Date: Mon Feb 4 12:04:35 2013 New Revision: 195708 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=195708 Log: 2013-02-04 Richard Biener <rguenther@suse.de> Backport from mainline 2012-07-04 Richard Guenther <rguenther@suse.de> PR tree-optimization/53844 * tree-ssa-dse.c (dse_possible_dead_store_p): Properly handle the loop virtual PHI. * g++.dg/tree-ssa/pr53844.C: New testcase. 2012-12-13 Richard Biener <rguenther@suse.de> PR lto/55660 * tree-streamer.c (record_common_node): Check that we are not recursively pre-loading nodes we want to skip. Handle char_type_node appearing as part of va_list_type_node. * gcc.dg/lto/pr55660_0.c: New testcase. * gcc.dg/lto/pr55660_1.c: Likewise. 2013-02-04 Richard Biener <rguenther@suse.de> PR middle-end/55890 * gimple.h (gimple_call_builtin_class_p): New function. * gimple.c (validate_call): New function. (gimple_call_builtin_class_p): Likewise. * tree-ssa-structalias.c (find_func_aliases_for_builtin_call): Use gimple_call_builtin_class_p. (find_func_clobbers): Likewise. * tree-ssa-strlen.c (adjust_last_stmt): Likewise. (strlen_optimize_stmt): Likewise. * gcc.dg/torture/pr55890-1.c: New testcase. * gcc.dg/torture/pr55890-2.c: Likewise. Added: branches/gcc-4_7-branch/gcc/testsuite/g++.dg/tree-ssa/pr53844.C branches/gcc-4_7-branch/gcc/testsuite/gcc.dg/lto/pr55660_0.c branches/gcc-4_7-branch/gcc/testsuite/gcc.dg/lto/pr55660_1.c branches/gcc-4_7-branch/gcc/testsuite/gcc.dg/torture/pr55890-1.c branches/gcc-4_7-branch/gcc/testsuite/gcc.dg/torture/pr55890-2.c Modified: branches/gcc-4_7-branch/gcc/ChangeLog branches/gcc-4_7-branch/gcc/gimple.c branches/gcc-4_7-branch/gcc/gimple.h branches/gcc-4_7-branch/gcc/testsuite/ChangeLog branches/gcc-4_7-branch/gcc/tree-ssa-dse.c branches/gcc-4_7-branch/gcc/tree-ssa-strlen.c branches/gcc-4_7-branch/gcc/tree-ssa-structalias.c branches/gcc-4_7-branch/gcc/tree-streamer.c
Fixed.