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]

[PATCH] Fix PR42927


This fixes overly strict verification.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.

Richard.

2010-02-02  Richard Guenther  <rguenther@suse.de>

	PR middle-end/42927
	* tree-cfg.c (verify_gimple_assign_binary): Fix shift verification.

	* gcc.c-torture/compile/pr42927.c: New testcase.

Index: gcc/tree-cfg.c
===================================================================
*** gcc/tree-cfg.c	(revision 156448)
--- gcc/tree-cfg.c	(working copy)
*************** verify_gimple_assign_binary (gimple stmt
*** 3287,3299 ****
  	if ((!INTEGRAL_TYPE_P (rhs1_type)
  	     && !FIXED_POINT_TYPE_P (rhs1_type)
  	     && !(TREE_CODE (rhs1_type) == VECTOR_TYPE
! 		  && TREE_CODE (TREE_TYPE (rhs1_type)) == INTEGER_TYPE))
  	    || (!INTEGRAL_TYPE_P (rhs2_type)
  		/* Vector shifts of vectors are also ok.  */
  		&& !(TREE_CODE (rhs1_type) == VECTOR_TYPE
! 		     && TREE_CODE (TREE_TYPE (rhs1_type)) == INTEGER_TYPE
  		     && TREE_CODE (rhs2_type) == VECTOR_TYPE
! 		     && TREE_CODE (TREE_TYPE (rhs2_type)) == INTEGER_TYPE))
  	    || !useless_type_conversion_p (lhs_type, rhs1_type))
  	  {
  	    error ("type mismatch in shift expression");
--- 3353,3365 ----
  	if ((!INTEGRAL_TYPE_P (rhs1_type)
  	     && !FIXED_POINT_TYPE_P (rhs1_type)
  	     && !(TREE_CODE (rhs1_type) == VECTOR_TYPE
! 		  && INTEGRAL_TYPE_P (TREE_TYPE (rhs1_type))))
  	    || (!INTEGRAL_TYPE_P (rhs2_type)
  		/* Vector shifts of vectors are also ok.  */
  		&& !(TREE_CODE (rhs1_type) == VECTOR_TYPE
! 		     && INTEGRAL_TYPE_P (TREE_TYPE (rhs1_type))
  		     && TREE_CODE (rhs2_type) == VECTOR_TYPE
! 		     && INTEGRAL_TYPE_P (TREE_TYPE (rhs2_type))))
  	    || !useless_type_conversion_p (lhs_type, rhs1_type))
  	  {
  	    error ("type mismatch in shift expression");
Index: gcc/testsuite/gcc.c-torture/compile/pr42927.c
===================================================================
*** gcc/testsuite/gcc.c-torture/compile/pr42927.c	(revision 0)
--- gcc/testsuite/gcc.c-torture/compile/pr42927.c	(revision 0)
***************
*** 0 ****
--- 1,32 ----
+ typedef unsigned int u_int8_t __attribute__ ((__mode__ (__QI__)));
+ typedef unsigned int u_int32_t __attribute__ ((__mode__ (__SI__)));
+ typedef enum { READ_SHARED = 0, WRITE_EXCLUSIVE = 1,
+     READ_EXCLUSIVE = 2, EXCLUSIVE_ACCESS = 3 } scsires_access_mode;
+ struct scsires_extent_elem {
+     scsires_access_mode mode;
+     unsigned relative_address;
+     u_int32_t first_block;
+     u_int32_t length;
+ };
+ typedef struct scsires_extent_elem scsires_extent_elem_t;
+ struct scsires_extent {
+     u_int8_t num_elements;
+     scsires_extent_elem_t *elements;
+ };
+ typedef struct scsires_extent scsires_extent_t;
+ unsigned char buf[512];
+ void scsires_issue_reservation(scsires_extent_t * new_extent)
+ {
+   int i;
+   for (i = 0; i < new_extent->num_elements; i++)
+     {
+       buf[(i * 8)] = new_extent->elements[i].mode;
+       buf[(i * 8) + 1] = ((new_extent->elements[i].length >> 16) & 0xff); 
+       buf[(i * 8) + 2] = ((new_extent->elements[i].length >> 8) & 0xff);
+       buf[(i * 8) + 3] = (new_extent->elements[i].length & 0xff);
+       buf[(i * 8) + 4] = ((new_extent->elements[i].first_block >> 24) & 0xff); 
+       buf[(i * 8) + 5] = ((new_extent->elements[i].first_block >> 16) & 0xff);
+       buf[(i * 8) + 6] = ((new_extent->elements[i].first_block >> 8) & 0xff);
+       buf[(i * 8) + 7] = (new_extent->elements[i].first_block & 0xff);
+     }
+ }


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