On Thu, 9 Jan 2014, Jakub Jelinek wrote:

> On Thu, Jan 09, 2014 at 12:31:47PM +0100, Richard Biener wrote:
> > On Thu, 9 Jan 2014, Jakub Jelinek wrote:
> > 
> > > On Thu, Jan 09, 2014 at 12:15:00PM +0100, Richard Biener wrote:
> > > > > Well, then the __cxa_pure_virtual testcases ICE again, but the 
> > > > > pr59622-5.C
> > > > > testcase ICEs anyway, so here is a different patch (untested so far 
> > > > > except
> > > > > for the tests).  The issue with the calls is that when fold_stmt is 
> > > > > done
> > > > > during gimplification (or omp lowering), we don't have cfg nor SSA 
> > > > > form and
> > > > > nothing performs fixup_noreturn_calls (that function requires CFG and 
> > > > > SSA
> > > > > form anyway).  So, we have to fix that up by hand, but as we aren't 
> > > > > in SSA
> > > > > form yet, dropping lhs is always safe for the noreturn calls.
> > > > 
> > > > Don't we "fix this up" during CFG build?
> > > 
> > > Sure, we do, but we ICE far before we get there.
> > > #0  error (gmsgid=0x1613b69 "LHS in noreturn call") at 
> > > ../../gcc/diagnostic.c:1041
> > > #1  0x0000000000d64c7b in verify_gimple_call (stmt=<gimple_call 
> > > 0x7ffff1a2b000>) at ../../gcc/tree-cfg.c:3149
> > > #2  0x0000000000d68e0f in verify_gimple_stmt (stmt=<gimple_call 
> > > 0x7ffff1a2b000>) at ../../gcc/tree-cfg.c:4323
> > > #3  0x0000000000d69430 in verify_gimple_in_seq_2 (stmts=0x7ffff1a232d0) 
> > > at ../../gcc/tree-cfg.c:4490
> > > #4  0x0000000000d69502 in verify_gimple_in_seq (stmts=0x7ffff1a232d0) at 
> > > ../../gcc/tree-cfg.c:4520
> > > #5  0x0000000000af3806 in gimplify_body (fndecl=<function_decl 
> > > 0x7ffff1a0da00 baz>, do_parms=true) at ../../gcc/gimplify.c:8599
> > > #6  0x0000000000af3c40 in gimplify_function_tree (fndecl=<function_decl 
> > > 0x7ffff1a0da00 baz>) at ../../gcc/gimplify.c:8684
> > 
> > So what fixes it for
> > 
> > int __attribute__((noreturn)) foo () {}
> > int main()
> > {
> >   return foo ();
> > }
> > 
> > ?
> 
> gimplify_modify_expr has:
> 
>       if (!gimple_call_noreturn_p (assign))
>         gimple_call_set_lhs (assign, *to_p);

Ok, it seems to be too early then - move it after the folding.

Richard.

Reply via email to