This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[tree-ssa] verify cond_expr condition type


As discussed re one of law's dominator changes.  Fortunately my fears
were unfounded and bootstrap and check passes with this installed.


r~


        * tree-cfg.c (verify_expr): Tidy.  Check COND_EXPR for boolean
        condition.

Index: tree-cfg.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-cfg.c,v
retrieving revision 1.1.4.255
diff -c -p -d -r1.1.4.255 tree-cfg.c
*** tree-cfg.c	15 Jan 2004 06:43:18 -0000	1.1.4.255
--- tree-cfg.c	17 Jan 2004 22:25:56 -0000
*************** static tree
*** 2774,2788 ****
  verify_expr (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED,
  	     void *data ATTRIBUTE_UNUSED)
  {
!   if (TREE_CODE (*tp) == SSA_NAME
!       && SSA_NAME_IN_FREE_LIST (*tp))
!     {
!       error ("SSA name in freelist still referred");
!       return *tp;
!     }
!   if (TREE_CODE (*tp) == ADDR_EXPR)
      {
!       tree x = TREE_OPERAND (*tp, 0);
        while (TREE_CODE (x) == ARRAY_REF
  	     || TREE_CODE (x) == COMPONENT_REF
  	     || TREE_CODE (x) == REALPART_EXPR
--- 2774,2793 ----
  verify_expr (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED,
  	     void *data ATTRIBUTE_UNUSED)
  {
!   tree t = *tp, x;
! 
!   switch (TREE_CODE (t))
      {
!     case SSA_NAME:
!       if (SSA_NAME_IN_FREE_LIST (t))
! 	{
! 	  error ("SSA name in freelist but still referenced");
! 	  return *tp;
! 	}
!       break;
! 
!     case ADDR_EXPR:
!       x = TREE_OPERAND (t, 0);
        while (TREE_CODE (x) == ARRAY_REF
  	     || TREE_CODE (x) == COMPONENT_REF
  	     || TREE_CODE (x) == REALPART_EXPR
*************** verify_expr (tree *tp, int *walk_subtree
*** 2792,2800 ****
  	return NULL;
        if (!TREE_ADDRESSABLE (x))
  	{
!           error ("Address taken, but ADDRESABLE bit not set");
            return x;
  	}
      }
    return NULL;
  }
--- 2797,2818 ----
  	return NULL;
        if (!TREE_ADDRESSABLE (x))
  	{
!           error ("address taken, but ADDRESABLE bit not set");
            return x;
  	}
+       break;
+ 
+     case COND_EXPR:
+       x = TREE_OPERAND (t, 0);
+       if (TREE_CODE (TREE_TYPE (x)) != BOOLEAN_TYPE)
+ 	{
+ 	  error ("non-boolean used in condition");
+ 	  return x;
+ 	}
+       break;
+ 
+     default:
+       break;
      }
    return NULL;
  }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]