$ /home/edwin/inst/bin/g++ -v Using built-in specs. COLLECT_GCC=/home/edwin/inst/bin/g++ COLLECT_LTO_WRAPPER=/home/edwin/inst/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.5.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: ../gcc/configure --enable-lto --enable-languages=c,c++ --enable-gold Thread model: posix gcc version 4.5.0 20091019 (experimental) (GCC) sh -x script + /home/edwin/inst/bin/g++ -fPIC SourceMgr.i -flto -fno-exceptions -O1 -c -o SourceMgr.o + /home/edwin/inst/bin/g++ -fPIC AsmMatcherEmitter.i -flto -O1 -c -o AsmMatcher.o + /home/edwin/inst/bin/g++ -flto -use-linked-plugin -O1 AsmMatcher.o SourceMgr.o -shared In function ‘EmitIsSubclass’: lto1: error: BB 14 can not throw but has an EH edge lto1: error: BB 15 can not throw but has an EH edge lto1: error: BB 16 can not throw but has an EH edge lto1: error: BB 18 can not throw but has an EH edge lto1: error: BB 19 can not throw but has an EH edge lto1: error: BB 20 can not throw but has an EH edge lto1: error: BB 22 can not throw but has an EH edge lto1: error: BB 23 can not throw but has an EH edge lto1: error: BB 25 can not throw but has an EH edge lto1: error: BB 26 can not throw but has an EH edge lto1: error: BB 27 can not throw but has an EH edge lto1: error: BB 30 can not throw but has an EH edge lto1: internal compiler error: verify_flow_info failed Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. lto-wrapper: /home/edwin/inst/bin/g++ returned 1 exit status collect2: lto-wrapper returned 1 exit status
Created attachment 18827 [details] SourceMgr.i preprocessed SourceMgr.i
Created attachment 18828 [details] AsmMatcherEmitter.i.bz2 bzipped preprocessed AsmMatcherEmitter.i
ld -v GNU gold (GNU Binutils for Debian 2.20) 1.9 This happens only if I use all of -flto -O1 -use-linker-plugin, not using -O1, or not using -use-linker-plugin hides the bug (and not using -flto too of course).
(In reply to comment #3) > ld -v > GNU gold (GNU Binutils for Debian 2.20) 1.9 > > This happens only if I use all of -flto -O1 -use-linker-plugin, not using -O1, > or not using -use-linker-plugin hides the bug (and not using -flto too of > course). > Actually -use-linker-plugin makes no difference
You can't merge no-exception and exception code, it seems. Should exceptions be enabled per-function for LTO?
Even that would be difficult - how would you inline between such functions? I think the only way is to force -fexceptions during the link stage if one translation unit did have it enabled. The -fno-exception TUs should have all stmts marked as not throwing. Sort of, but well - this is a very low priority bug. (Falls into the class of "different flags used for compiling and linking") I'll try a very simple hack.
I would vote for LTO frotnend simply sorrying when seeing units with and without exceptions. Honza
I wonder if we should simply ignore -fno-exceptions/-fexceptions passed to lto1 and rely on the automated discovery. The testcase btw works for me on i?86. The proposed patch would delete handling of OPT_fexceptions from register_user_option_p and add flag_exceptions = 0 to lto_init_options in case you can still reproduce the issue.
Fixed for GCC 8 with r8-4560. Though fixed fully with r10-3246.