public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-10629] tree-optimization/109491 - ICE in expressions_equal_p
@ 2023-04-17 10:44 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2023-04-17 10:44 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:bb400f9916beab1a650d59c73672ef48aaf71b11

commit r11-10629-gbb400f9916beab1a650d59c73672ef48aaf71b11
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Apr 13 14:09:30 2023 +0200

    tree-optimization/109491 - ICE in expressions_equal_p
    
    At some point I elided the NULL pointer check in expressions_equal_p
    because it shouldn't be necessary not realizing that for example
    TARGET_MEM_REF has optional operands we cannot substitute with
    something non-NULL with the same semantics.  The following does the
    simple thing and restore the check removed in r11-4982.
    
            PR tree-optimization/109491
            * tree-ssa-sccvn.c (expressions_equal_p): Restore the
            NULL operands test.
    
    (cherry picked from commit a37783de23c067d6a26374ff29c014e49604035c)

Diff:
---
 gcc/tree-ssa-sccvn.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c
index a4a66f22ff0..ec5d7cac7f8 100644
--- a/gcc/tree-ssa-sccvn.c
+++ b/gcc/tree-ssa-sccvn.c
@@ -5789,6 +5789,13 @@ expressions_equal_p (tree e1, tree e2)
   if (e1 == VN_TOP || e2 == VN_TOP)
     return true;
 
+  /* If only one of them is null, they cannot be equal.  While in general
+     this should not happen for operations like TARGET_MEM_REF some
+     operands are optional and an identity value we could substitute
+     has differing semantics.  */
+  if (!e1 || !e2)
+    return false;
+
   /* SSA_NAME compare pointer equal.  */
   if (TREE_CODE (e1) == SSA_NAME || TREE_CODE (e2) == SSA_NAME)
     return false;

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

only message in thread, other threads:[~2023-04-17 10:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-17 10:44 [gcc r11-10629] tree-optimization/109491 - ICE in expressions_equal_p 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).