On Thu, Mar 29, 2012 at 3:59 PM, Michael Matz <m...@suse.de> wrote: > Hi, > > On Thu, 29 Mar 2012, Stephan Bergmann wrote: > >> > > Anyway, would it be worthwhile filing an RFE for an asm annotation >> > > telling the compiler that it contains code that can throw? >> > >> > I suppose yes. >> >> <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52770> "RFE: Letting >> compiler know asm block can call function that can throw." > > Actually, with -fnon-call-exceptions volatile asms are already supposed to > be throwing. It's just that this got lost with tree-ssa. With the patch > and -fnon-call-exceptions a simple "__asm__ volatile (...)" is regarded as > possibly throwing. > > Without -fnon-call-exceptions some parser changes would be required. How > about "asm throw (...)" ? > > > Ciao, > Michael. > Index: tree-eh.c > =================================================================== > --- tree-eh.c (revision 183716) > +++ tree-eh.c (working copy) > @@ -1959,6 +1959,7 @@ lower_eh_constructs_2 (struct leh_state > } > /* FALLTHRU */ > > + case GIMPLE_ASM: > case GIMPLE_ASSIGN: > /* If the stmt can throw use a new temporary for the assignment > to a LHS. This makes sure the old value of the LHS is
This does not handle using a temporary for all (register) outputs ... I suppose the code should walk all SSA defs instead of looking at the LHS only. > Index: tree-cfg.c > =================================================================== > --- tree-cfg.c (revision 183716) > +++ tree-cfg.c (working copy) > @@ -580,6 +580,8 @@ make_edges (void) > > case GIMPLE_ASM: > make_gimple_asm_edges (bb); > + if (is_ctrl_altering_stmt (last)) > + make_eh_edges (last); > fallthru = true; > break; Otherwise this looks reasonable. With a testcase, I suppose ;) Richard.