On Tue, Dec 31, 2013 at 08:39:02AM +0100, Richard Biener wrote: > >That said, fold_stmt callers have to be prepared to handle say a normal > >call becoming noreturn call, consider say: > > > >struct A { virtual int foo (); }; > >struct B : public A { int foo () __attribute__((noreturn)); }; > >int B::foo () { __builtin_exit (0); } > >int bar () > >{ > > B b; > > B *p = &b; > > return p->foo (); > >} > > Is that a valid specialization though?
I think so, after all don't we set noreturn attribute automatically even if it is missing when IPA can prove the function never returns? If we fold_stmt after that, the above testcase even without explicit noreturn attribute would need cfg cleanup. Perhaps gimple_fold_call should punt and not change fndecl if !inplace if some call flags have changed that would require cfg cleanup, making at least fold_stmt_inplace callers not having to deal with it, and make sure fold_stmt callers schedule cleanup_cfg when fold_stmt returns true? Jakub