Patch to projects.html: glibc's string function macros

Kaveh R. Ghazi ghazi@caip.rutgers.edu
Tue Oct 31 10:44:00 GMT 2000


 > From: Mark Mitchell <mark@codesourcery.com>
 > 
 > >>>>> "Richard" == Richard Henderson <rth@cygnus.com> writes:
 > 
 >     Richard> Ok.
 > 
 > Just one minor thought: since expand_expr already knows not to bother
 > expanding things that don't have side-effects, I think we should just
 > always call it in these kinds of places.  That will keep the code
 > simpler.

Okay, I followed your suggestion.  Here's the revised bit that always
calls expand_expr.

Checked (in along with the testcase) after passing bootstrap/testsuite
on solaris2.7.

Index: builtins.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/builtins.c,v
retrieving revision 1.60
diff -u -p -r1.60 builtins.c
--- builtins.c	2000/10/06 14:59:56	1.60
+++ builtins.c	2000/10/31 18:21:33
@@ -2351,7 +2351,13 @@ expand_builtin_fputs (arglist, ignore)
   switch (compare_tree_int (len, 1))
     {
     case -1: /* length is 0, delete the call entirely .  */
-      return const0_rtx;
+      {
+	/* Evaluate and ignore the argument in case it has
+           side-effects.  */
+	expand_expr (TREE_VALUE (TREE_CHAIN (arglist)), const0_rtx,
+		     VOIDmode, EXPAND_NORMAL);
+	return const0_rtx;
+      }
     case 0: /* length is 1, call fputc.  */
       {
 	tree stripped_string = TREE_VALUE (arglist);


More information about the Gcc-patches mailing list