This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH: PR c++/37450: [4.4 Regression] C++ FE times out on duplicated parameter
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sat, 13 Sep 2008 15:57:33 -0700
- Subject: 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))