tree-cfg: Fix misleading error message in verify_gimple_assign_single.

Message ID 20231210152015.126126-2-xndchn@gmail.com
State Accepted
Headers
Series tree-cfg: Fix misleading error message in verify_gimple_assign_single. |

Checks

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

Commit Message

xndcn Dec. 10, 2023, 3:20 p.m. UTC
  gcc/ChangeLog:

	* tree-cfg.cc (verify_gimple_assign_single): Fix misleading error, from "invalid LHS ..." to "invalid RHS ..."

Signed-off-by: xndcn <xndchn@gmail.com>
---
 gcc/tree-cfg.cc | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
  

Patch

diff --git a/gcc/tree-cfg.cc b/gcc/tree-cfg.cc
index d784b9115..f041786b3 100644
--- a/gcc/tree-cfg.cc
+++ b/gcc/tree-cfg.cc
@@ -4695,7 +4695,7 @@  verify_gimple_assign_single (gassign *stmt)
       if (!is_gimple_reg (lhs)
 	  && is_gimple_reg_type (TREE_TYPE (lhs)))
 	{
-	  error ("invalid RHS for gimple memory store: %qs", code_name);
+	  error ("invalid LHS for gimple memory store: %qs", code_name);
 	  debug_generic_stmt (lhs);
 	  debug_generic_stmt (rhs1);
 	  return true;
@@ -4721,7 +4721,10 @@  verify_gimple_assign_single (gassign *stmt)
 	  && !is_gimple_reg (rhs1)
 	  && is_gimple_reg_type (TREE_TYPE (lhs)))
 	{
-	  error ("invalid RHS for gimple memory store: %qs", code_name);
+	  if (!is_gimple_reg (rhs1))
+	    error ("invalid RHS for gimple memory store: %qs", code_name);
+	  else
+	    error ("invalid LHS for gimple memory store: %qs", code_name);
 	  debug_generic_stmt (lhs);
 	  debug_generic_stmt (rhs1);
 	  return true;