This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Compiler crash with block numbers


On Thu, Sep 20, 2012 at 12:59 PM, Dehao Chen <dehao@google.com> wrote:
> The bug is in tree-eh.c. IS_UNKNOWN_LOCATION is mistakenly used, thus
> the block info for a call stmt is cleared.
>
> A patch to fix the problem is atached:
>
> gcc/ChangeLog:
>         tree-eh.c (lower_try_finally_dup_block): Use correct way to
> check unknown location.
>
> Index: tree-eh.c
> ===================================================================
> --- tree-eh.c   (revision 191494)
> +++ tree-eh.c   (working copy)
> @@ -883,7 +883,7 @@ lower_try_finally_dup_block (gimple_seq seq, struc
>    new_seq = copy_gimple_seq_and_replace_locals (seq);
>
>    for (gsi = gsi_start (new_seq); !gsi_end_p (gsi); gsi_next (&gsi))
> -    if (IS_UNKNOWN_LOCATION (gimple_location (gsi_stmt (gsi))))
> +    if (gimple_location (gsi_stmt (gsi)) == UNKNOWN_LOCATION)
>        gimple_set_location (gsi_stmt (gsi), loc);
>
>    if (outer_state->tf)
>
> Is it ok for trunk?


Without much background on this, this seems far too error-prone.  What
is the difference between IS_UNKNOWN_LOCATION (x) and x ==
UNKNOWN_LOCATION?  Where is that difference documented?  How can we
avoid similar errors in the future?

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]