This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ 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]

Re: [PATCH] Builtins and C++ and such (take 3)



> So, no situation is ideal here. Can we have some forward movement here
> within the next 24 hours or revert?

Here's a fix to the problem.  This solves the three libstdc++-v3
regressions currently in mainline CVS from my "C++ builtins" patch,
but without introducing the handfull of g++ testsuite regressions.

The change is to only call the "SET_DECL_RTL" when we know we're
over writting an artificial function declaration.  It seems that
the mysterious RTL behaviour used to "flag" inlining, is also
used for other purposes in the g++ front-end.

I think I also know why I hadn't seen the regressions earlier.  My
first patch to cmath didn't reorder the double case for std::abs.
See http://gcc.gnu.org/ml/gcc/gcc-patches/2002-03/msg/msg01513.html
So the other moral of this affair is that cmath should probably also
contain the prototype "int abs(int);" in std:: before the floating
point cases, to avoid disabling the built-in processing of integer
std::abs.

Hopefully, this'll be the first e-mail in the thread that Mark reads
when he gets back into the office after the holiday weekend, and all
will be set right with the world.

Tested on i686-pc-linux-gnu.  Mark and Ben, does this work for you?


2002-04-01  Roger Sayle  <roger@eyesopen.com>
	* decl.c (duplicate_decls):  Overwrite the RTL when (and only
	when) overwriting a built-in function.  Don't use COPY_DECL_RTL,
	but follow the SET_DECL_RTL idiom used elsewhere in the function.
	Fixes libstdc++-v3 testsuite regressions.


Index: decl.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/cp/decl.c,v
retrieving revision 1.885
diff -c -3 -p -r1.885 decl.c
*** decl.c	29 Mar 2002 21:46:21 -0000	1.885
--- decl.c	1 Apr 2002 13:04:36 -0000
*************** duplicate_decls (newdecl, olddecl)
*** 3202,3207 ****
--- 3202,3210 ----
  	  else
  	    /* Discard the old built-in function.  */
  	    return 0;
+
+ 	  /* Replace the old RTL to avoid problems with inlining.  */
+ 	  SET_DECL_RTL (olddecl, DECL_RTL (newdecl));
  	}

        if (DECL_THIS_STATIC (newdecl) && !DECL_THIS_STATIC (olddecl))
*************** duplicate_decls (newdecl, olddecl)
*** 3623,3629 ****
        TREE_READONLY (olddecl) = TREE_READONLY (newdecl);
        TREE_THIS_VOLATILE (olddecl) = TREE_THIS_VOLATILE (newdecl);
        TREE_SIDE_EFFECTS (olddecl) = TREE_SIDE_EFFECTS (newdecl);
-       COPY_DECL_RTL (newdecl, olddecl);
      }

    /* Merge the storage class information.  */
--- 3626,3631 ----

Roger
--
Roger Sayle,                         E-mail: roger@eyesopen.com
OpenEye Scientific Software,         WWW: http://www.eyesopen.com/
Suite 1107, 3600 Cerrillos Road,     Tel: (+1) 505-473-7385
Santa Fe, New Mexico, 87507.         Fax: (+1) 505-473-0833


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