tree-optimization/107956 - ICE with NULL call LHS

Message ID 20221205081117.B59B11348F@imap1.suse-dmz.suse.de
State Accepted
Headers
Series tree-optimization/107956 - ICE with NULL call LHS |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Li, Pan2 via Gcc-patches Dec. 5, 2022, 8:11 a.m. UTC
  The following adds a missing check for a NULL call LHS in the
vector pattern recognizer.

Pushed as obvious.

	PR tree-optimization/107956
	* tree-vect-patterns.cc (vect_recog_mask_conversion_pattern):
	Check for NULL LHS on masked loads.
---
 gcc/tree-vect-patterns.cc | 2 ++
 1 file changed, 2 insertions(+)
  

Patch

diff --git a/gcc/tree-vect-patterns.cc b/gcc/tree-vect-patterns.cc
index f6c34bb3263..d9fdb24ee62 100644
--- a/gcc/tree-vect-patterns.cc
+++ b/gcc/tree-vect-patterns.cc
@@ -4964,6 +4964,8 @@  vect_recog_mask_conversion_pattern (vec_info *vinfo,
       else
 	{
 	  lhs = gimple_call_lhs (last_stmt);
+	  if (!lhs)
+	    return NULL;
 	  vectype1 = get_vectype_for_scalar_type (vinfo, TREE_TYPE (lhs));
 	}