On Mon, Jan 02, 2017 at 04:38:03PM -0700, Martin Sebor wrote:
> Thanks for taking care of this bug!  Punting on this case sounds
> fine.
> 
> I was not familiar with the stmt_ends_bb_p() function or how it
> relates to exceptions so I looked it up.  It looks to be a wrapper
> around is_ctrl_stmt() and is_ctrl_altering_stmt().  Of the two, it
> looks to me like the first one will always return false here because
> a function call is not a control statement, and the second will end
> up returning the result of g gimple_call_ctrl_altering_p() because
> the argument is a GIMPLE_CALL.  Would it be appropriate to call
> gimple_call_ctrl_altering_p() here directly instead? (I ask mainly
> because to me, unlike the former, the latter clearly conveys that
> it's being called to determine whether the function call may alter
> control flow [such as by throwing].)

stmt_ends_bb_p is the general predicate for whether stmt has to end a basic
block (and in that case e.g. it is invalid to gsi_insert_after (gsi, g, 
GSI_NEW_STMT);
when gsi_stmt (*gsi) == stmt), so for the !info.nowrite case it is the right
predicate, because it tests the property we want to avoid.
For the info.nowrite case we care only whether the stmt throws, i.e.
if lookup_stmt_eh_lp (stmt) != 0, but as the stmt_ends_bb_p predicate covers
all those cases and no others, it is IMO fine too.

        Jakub

Reply via email to