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 regression with pointer-to-member constants


This is a follow-up to David Baron's patch from 9/15/2003 (http://gcc.gnu.org/ml/gcc-patches/2003-09/msg00947.html). I have a patch which fixes the two regression test failures caused by the original patch. I have combined the two into the patch below.

I ran through all of the regression tests with this patch and there were no additional failures; also I've tested that this allows Mozilla to run again.

I'm pretty new to this, so any feedback you could give me on the patch would be great. Thanks.

--
-Brian Ryner
bryner@brianryner.com
2003-11-14  Brian Ryner  <bryner@brianryner.com>

	PR c++/12218
	* convert.c (convert_to_integer): Allow OFFSET_TYPE to be converted to
	an integer.
	* fold-const.c (fold_convert): Handle OFFSET_TYPE.  Patch by
	David Baron <dbaron@dbaron.org>.

Index: convert.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/convert.c,v
retrieving revision 1.35
diff -u -p -c -3 -p -r1.35 convert.c
*** convert.c	1 Sep 2003 05:02:08 -0000	1.35
--- convert.c	14 Nov 2003 21:26:04 -0000
*************** convert_to_integer (tree type, tree expr
*** 313,318 ****
--- 313,319 ----
      case ENUMERAL_TYPE:
      case BOOLEAN_TYPE:
      case CHAR_TYPE:
+     case OFFSET_TYPE:
        /* If this is a logical operation, which just returns 0 or 1, we can
  	 change the type of the expression.  For some logical operations,
  	 we must also change the types of the operands to maintain type
Index: fold-const.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/fold-const.c,v
retrieving revision 1.316
diff -u -p -c -3 -p -r1.316 fold-const.c
*** fold-const.c	1 Nov 2003 00:59:53 -0000	1.316
--- fold-const.c	14 Nov 2003 21:26:07 -0000
*************** fold_convert (tree t, tree arg1)
*** 1666,1672 ****
    tree type = TREE_TYPE (t);
    int overflow = 0;
  
!   if (POINTER_TYPE_P (type) || INTEGRAL_TYPE_P (type))
      {
        if (TREE_CODE (arg1) == INTEGER_CST)
  	{
--- 1666,1673 ----
    tree type = TREE_TYPE (t);
    int overflow = 0;
  
!   if (POINTER_TYPE_P (type) || INTEGRAL_TYPE_P (type)
!       || TREE_CODE(type) == OFFSET_TYPE)
      {
        if (TREE_CODE (arg1) == INTEGER_CST)
  	{

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