public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-2243] middle-end/101423 - internal calls do not trap
@ 2021-07-12 10:18 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2021-07-12 10:18 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:123d0a597beb6d9865f808bf15b0d67f2a8fd5b2

commit r12-2243-g123d0a597beb6d9865f808bf15b0d67f2a8fd5b2
Author: Richard Biener <rguenther@suse.de>
Date:   Mon Jul 12 10:26:25 2021 +0200

    middle-end/101423 - internal calls do not trap
    
    This adjusts gimple_could_trap_p to not consider internal function
    calls to trap compared to indirect calls or calls to weak functions.
    
    2021-07-12  Richard Biener  <rguenther@suse.de>
    
            PR middle-end/101423
            * gimple.c (gimple_could_trap_p_1): Internal function calls
            do not trap.
            * tree-eh.c (tree_could_trap_p): Likewise.

Diff:
---
 gcc/gimple.c  | 4 +++-
 gcc/tree-eh.c | 5 ++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/gcc/gimple.c b/gcc/gimple.c
index 60a90667e4b..cc464547e34 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -2149,8 +2149,10 @@ gimple_could_trap_p_1 (gimple *s, bool include_mem, bool include_stores)
       return gimple_asm_volatile_p (as_a <gasm *> (s));
 
     case GIMPLE_CALL:
+      if (gimple_call_internal_p (s))
+	return false;
       t = gimple_call_fndecl (s);
-      /* Assume that calls to weak functions may trap.  */
+      /* Assume that indirect and calls to weak functions may trap.  */
       if (!t || !DECL_P (t) || DECL_WEAK (t))
 	return true;
       return false;
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
index 601285c401c..57ce8f04a43 100644
--- a/gcc/tree-eh.c
+++ b/gcc/tree-eh.c
@@ -2723,8 +2723,11 @@ tree_could_trap_p (tree expr)
       return TREE_THIS_VOLATILE (expr);
 
     case CALL_EXPR:
+      /* Internal function calls do not trap.  */
+      if (CALL_EXPR_FN (expr) == NULL_TREE)
+	return false;
       t = get_callee_fndecl (expr);
-      /* Assume that calls to weak functions may trap.  */
+      /* Assume that indirect and calls to weak functions may trap.  */
       if (!t || !DECL_P (t))
 	return true;
       if (DECL_WEAK (t))


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-07-12 10:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-12 10:18 [gcc r12-2243] middle-end/101423 - internal calls do not trap Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).