On Thu, 24 Sep 2015, Johan Alfredsson wrote: > I'm seeing this already at -O1 (-O0 is fine, no deadlock). Now, I > tried to bisect whatever options -O1 implies by looking at what g++ -Q > -O1... produced, but it turns out that when I use the full list of > options (except for -fleading-underscore and -fgnu-runtime, which > obviously are not actually used for my -O1 compile, as either the > compiler complains that I'm not using LTO or the linker complains > about ___dso_handle being undefined for libstdc++ code) I don't get > the deadlock anymore. As GCC manual mentions, without -O optimizations are disabled, even if individual flags are passed on the command line (how did you find out about -Q, and yet not about that restriction?). Thus, you have to keep -O1 and add -fno-... flags to disable optimizations, if you want to bisect on that basis. (the manual also mentions that not all optimizations have a flag, so even if the above restriction wasn't there, such bisection would still have to work by removing optimization from a failing level) Alexander