[PATCH][TUPLES] Two simple bug fixes.

Richard Guenther richard.guenther@gmail.com
Mon Apr 14 11:04:00 GMT 2008


On Mon, Apr 14, 2008 at 11:36 AM, Doug Kwan ($Bop?6y~(B) <dougkwan@google.com> wrote:
> Sorry, I was wrong in my previous reply. i.ptr->stmt, not i.ptr is
>  NULL for an empty gimple_seq (I probably should go to bed by now :)).
>  Still, we need to special case.  I remember seeing a comment about
>  valid gsi with NULL bb when it points outside of any basic blocks.
>  However, I cannot find the relevant comment. (Diego, did you change
>  the API doc or did we ever allow a gsi with no bb?).

Ok.  So we have bb in gsi only as

 1) cache if stmt is not NULL
 2) the bb for new stmts if the sequence is empty

somehow it feels "wrong" ;)  I realize that putting bb into gimple_seq
instead may equally feel wrong, but I often enough saw bogus stmt
bbs with

  bsi = bsi_for_stmt (stmt);
  split_block (bb_for_stmt (stmt), stmt);
  bsi_insert_before (&bsi, ...);

because split_block obviously doesn't update the bsi and while stmt
is still correct, the cached bb is not anymore.  The interface
bsi_for_stmt (stmt) doesn't suggest that the bb is cached but not updated.
So I end up doing

  bsi = bsi_for_stmt (bsi_stmt (bsi));

after splitting blocks, which looks ... ugly.

Maybe this sheds some light on my somewhat confusing queries to make
gsis less error prone here (and in the case you ran into, which is similar,
a bogus bb recorded in the gsi).

Thanks,
Richard.



More information about the Gcc-patches mailing list