On Thu, Sep 10, 2026 at 1:52 AM <[email protected]> wrote:
>
> From: Kyrylo Tkachov <[email protected]>
>
> tree_could_trap_p checks an expression as an rvalue.  lhs_could_trap_p
> checks an expression as a store destination.  State this difference in the
> function comments.  Also correct the lhs_could_trap_p comment, which states
> the opposite result.
>
> No functional change.

Ok.

>
> gcc/ChangeLog:
>
>         * tree-eh.cc (tree_could_trap_1, tree_could_trap_p): Clarify the
>         function comments.
>         (lhs_could_trap_p): Correct the function comment.
>
> Signed-off-by: Kyrylo Tkachov <[email protected]>
> ---
>  gcc/tree-eh.cc | 15 ++++++---------
>  1 file changed, 6 insertions(+), 9 deletions(-)
>
> diff --git a/gcc/tree-eh.cc b/gcc/tree-eh.cc
> index d2c2f3b3157..5939f5563ce 100644
> --- a/gcc/tree-eh.cc
> +++ b/gcc/tree-eh.cc
> @@ -2753,9 +2753,9 @@ ref_outside_object_p (tree size, poly_offset_int off, 
> tree refsz)
>  }
>
>  /* Return true if EXPR can trap, as in dereferencing an invalid pointer
> -   location or floating point arithmetic.  C.f. the rtl version, may_trap_p.
> -   This routine expects only GIMPLE lhs or rhs input.
> -   LHS is true when LHS is a lhs.  */
> +   location or evaluating floating-point arithmetic.  See may_trap_p for the
> +   RTL counterpart.  This routine expects only GIMPLE lhs or rhs input.  LHS
> +   is true when EXPR is the lhs of a store.  */
>
>  static bool
>  tree_could_trap_1 (tree expr, bool lhs)
> @@ -2935,11 +2935,8 @@ tree_could_trap_1 (tree expr, bool lhs)
>      }
>  }
>
> -
> -
> -/* Return true if EXPR can trap, as in dereferencing an invalid pointer
> -   location or floating point arithmetic.  C.f. the rtl version, may_trap_p.
> -   This routine expects only GIMPLE lhs or rhs input.  */
> +/* Return true if EXPR can trap when evaluated as an rvalue.  See may_trap_p
> +   for the RTL counterpart.  */
>
>  bool
>  tree_could_trap_p (tree expr)
> @@ -2947,7 +2944,7 @@ tree_could_trap_p (tree expr)
>    return tree_could_trap_1 (expr, false);
>  }
>
> -/* Returns true if LHS is known not to trap as a store.  */
> +/* Return true if LHS can trap as a store.  */
>  bool
>  lhs_could_trap_p (tree lhs)
>  {
> --
> 2.50.1 (Apple Git-155)
>

Reply via email to