http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55219
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-11-07 14:18:36 UTC --- Slightly deobfuscated testcase: int x, c, d, e, f, g, h, i; double j; const int k; const enum { B } a; void fn1 (void) { h = (g ? c : g ? f : g ? e : g ? i : g ? f : g ? e : g ? d : x) + (a ? : a ? : a ? : a ? : a ? : a ? : a ? : a ? : a ? : a ? : a ? j : a ? : 0 ? : a ? : a ? : a ? : a ? : a ? : a ? k : a ? : x); } Worst case we could introduce a static counter that could be increased at the beginning of the fold_binary_op_with_conditional_arg and cleared at the end of that function if it was originally 0, and just give up if there are more than say a few hundred calls.