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: PR c++/37450: [4.4 Regression] C++ FE times out on duplicated parameter


C++ FE times out on g++.old-deja/g++.mike/warn4.C since
pushdecl_maybe_friend returns the old parameter when there is
a duplicate. As the result,

  for (; parms; parms = TREE_CHAIN (parms))

becomes an infinite loop since TREE_CHAIN (parms) == parms.  This
patch fixes it.  OK for trunk?

Thanks.


H.J.
---
2008-09-13  H.J. Lu  <hongjiu.lu@intel.com>

	PR c++/37450
	* name-lookup.c (pushdecl_maybe_friend): Don't return the old
	parameter for duplicate.

--- gcc/cp/name-lookup.c.dup	2008-09-08 20:21:40.000000000 -0700
+++ gcc/cp/name-lookup.c	2008-09-13 15:44:01.000000000 -0700
@@ -720,8 +720,9 @@ pushdecl_maybe_friend (tree x, bool is_f
 	  else if (TREE_CODE (t) == PARM_DECL)
 	    {
 	      /* Check for duplicate params.  */
-	      if (duplicate_decls (x, t, is_friend))
-		POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, t);
+	      tree d = duplicate_decls (x, t, is_friend);
+	      if (d)
+		POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, d);
 	    }
 	  else if ((DECL_EXTERN_C_FUNCTION_P (x)
 		    || DECL_FUNCTION_TEMPLATE_P (x))


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