https://gcc.gnu.org/g:8360a020430078ee3e2d05b9e4456223ceb029d2

commit r17-4155-g8360a020430078ee3e2d05b9e4456223ceb029d2
Author: Kyrylo Tkachov <[email protected]>
Date:   Wed Sep 9 16:31:52 2026 +0200

    tree-eh: Correct trap-query function comments
    
    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.
    
    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]>

Diff:
---
 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 d2c2f3b3157d..5939f5563cef 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)
 {

Reply via email to