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 PR60474


IVOPTs asks for unsigned types of random integral types, but
OFFSET_TYPEs are not handled in unsigned_type_for.  The following
fixes that.

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

Richard.

2014-03-10  Richard Biener  <rguenther@suse.de>

	PR middle-end/60474
	* tree.c (signed_or_unsigned_type_for): Handle OFFSET_TYPEs.

	* g++.dg/torture/pr60474.C: New testcase.

Index: gcc/tree.c
===================================================================
*** gcc/tree.c	(revision 208448)
--- gcc/tree.c	(working copy)
*************** signed_or_unsigned_type_for (int unsigne
*** 10588,10594 ****
      }
  
    if (!INTEGRAL_TYPE_P (type)
!       && !POINTER_TYPE_P (type))
      return NULL_TREE;
  
    return build_nonstandard_integer_type (TYPE_PRECISION (type), unsignedp);
--- 10588,10595 ----
      }
  
    if (!INTEGRAL_TYPE_P (type)
!       && !POINTER_TYPE_P (type)
!       && TREE_CODE (type) != OFFSET_TYPE)
      return NULL_TREE;
  
    return build_nonstandard_integer_type (TYPE_PRECISION (type), unsignedp);
Index: gcc/testsuite/g++.dg/torture/pr60474.C
===================================================================
*** gcc/testsuite/g++.dg/torture/pr60474.C	(revision 0)
--- gcc/testsuite/g++.dg/torture/pr60474.C	(working copy)
***************
*** 0 ****
--- 1,16 ----
+ // { dg-do compile }
+ 
+ struct Layer;
+ template <typename> struct A
+ {
+   Layer *m_fn1 ();
+   Layer &operator[](int p1) { return m_fn1 ()[p1]; }
+ };
+ struct Layer
+ {
+ };
+ void fn1 (A<int> &p1, int Layer::*p2, int p3)
+ {
+   for (int a = 0;; ++a, ++p3)
+     p1[p3].*p2 = p1[a].*p2;
+ }


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