LTO should display a error message to indicate that gnu-tm is not enabled and not ICE. lto1: internal compiler error: in streamer_get_builtin_tree, at tree-streamer-in.c:1056 Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. 1051 if (fclass == BUILT_IN_NORMAL) 1052 { 1053 if (fcode >= END_BUILTINS) 1054 fatal_error ("machine independent builtin code out of range"); 1055 result = builtin_decl_explicit (fcode); 1056 gcc_assert (result); 1057 } (gdb) p fcode $2 = BUILT_IN_TM_COMMIT (gdb) bt #0 fancy_abort (file=0x12b2168 "../../trunk/gcc/tree-streamer-in.c", line=1056, function=0x12b2250 "streamer_get_builtin_tree") at ../../trunk/gcc/diagnostic.c:899 #1 0x0000000000c4f5ea in streamer_get_builtin_tree (ib=0x7fffffffd760, data_in=0x1a273d0) at ../../trunk/gcc/tree-streamer-in.c:1056 #2 0x00000000008b5aeb in lto_input_tree (ib=0x7fffffffd760, data_in=0x1a273d0) at ../../trunk/gcc/lto-streamer-in.c:1148 #3 0x00000000004b052a in lto_read_decls (decl_data=0x7ffff69b9000, data=0x1a36970, resolutions=0x1a26320) at ../../trunk/gcc/lto/lto.c:902 #4 0x00000000004b0e25 in lto_file_finalize (file_data=0x7ffff69b9000, file=0x19944a0) at ../../trunk/gcc/lto/lto.c:1140 #5 0x00000000004b0e72 in lto_create_files_from_ids (file=0x19944a0, file_data=0x7ffff69b9000, count=0x7fffffffd8ec) at ../../trunk/gcc/lto/lto.c:1150 #6 0x00000000004b0f8b in lto_file_read (file=0x19944a0, resolution_file=0x1a25460, count=0x7fffffffd8ec) at ../../trunk/gcc/lto/lto.c:1190 #7 0x00000000004b8095 in read_cgraph_and_symbols (nfiles=1, fnames=0x19af0f0) at ../../trunk/gcc/lto/lto.c:2591 #8 0x00000000004b87da in lto_main () at ../../trunk/gcc/lto/lto.c:2905 #9 0x00000000009ffe99 in compile_file () at ../../trunk/gcc/toplev.c:565 #10 0x0000000000a021a9 in do_compile () at ../../trunk/gcc/toplev.c:1931 #11 0x0000000000a02314 in toplev_main (argc=17, argv=0x197d2e0) at ../../trunk/gcc/toplev.c:2007 #12 0x00000000004bb7c4 in main (argc=17, argv=0x7fffffffda68) at ../../trunk/gcc/main.c:36 To reproduce, compile file with transactions and lto, and link without -flto. Patrick.
Created attachment 25904 [details] testcase (wrong one) Of course this bug also affect openMP. (see testcase)
I can't reproduce this: houston:/build/t/gcc$ cat b.c int main() { return __builtin_omp_get_thread_num(); } houston:/build/t/gcc$ ./xgcc -B./ -c -fgnu-tm -flto b.c -o b.o houston:/build/t/gcc$ ./xgcc -B./ b.o -L /usr/lib/gcc/x86_64-redhat-linux/4.6.2/ -lgomp houston:/build/t/gcc$ ./a.out houston:/build/t/gcc$ I've tried various other variations, but I can't reproduce. Please clarify.
Created attachment 26040 [details] testcase for gnu-tm Well, I don't know why I can't reproduce it for openmp. I will try to have a look at it next week. At least, attached the testcase for trans-mem. $ ./xgcc -B. -fgnu-tm -flto -c lto.c -o lto.o $ ./xgcc -B. -flto -o lto lto.o lto1: internal compiler error: in streamer_get_builtin_tree, at tree-streamer-in.c:1056 Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. lto-wrapper: ./xgcc returned 1 exit status /usr/bin/ld: lto-wrapper failed collect2: error: ld returned 1 exit status Patrick.
For OpenMP it shouldn't be a problem, all the 3 OpenMP passes (part of gimplification, omplower and ompexp) are before LTO streaming, flag_openmp isn't used afterwards, so the only effect of not using -fopenmp for lto phase will be that -lgomp won't be added automatically.
Ok, reproduced as below. -flto was missing from the link line. houston:/build/t2/gcc$ ./xgcc -B./ -c -fgnu-tm -flto -c a.c -o a.ohouston:/build/t2/gcc$ ./xgcc -B./ a.o -flto -L ../x86_64-unknown-linux-gnu/libitm/.libs/ -litm lto1: internal compiler error: in streamer_get_builtin_tree, at tree-streamer-in.c:1077 Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. lto-wrapper: ./xgcc returned 1 exit status /usr/bin/ld: lto-wrapper failed collect2: error: ld returned 1 exit status houston:/build/t2/gcc$
Author: aldyh Date: Thu Jan 19 13:57:04 2012 New Revision: 183303 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=183303 Log: PR lto/51280 * lto-wrapper.c (run_gcc): Pass -fgnu_tm on. (merge_and_complain): Same. Added: trunk/gcc/testsuite/gcc.dg/lto/trans-mem-3_0.c trunk/gcc/testsuite/gcc.dg/lto/trans-mem-3_1.c Modified: trunk/gcc/ChangeLog trunk/gcc/lto-wrapper.c
fixed