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]

Re: [PATCH] detect unknown type names in declaration


On Sat, Nov 13, 2010 at 8:51 AM, Paolo Bonzini <bonzini@gnu.org> wrote:
> On 11/13/2010 05:25 PM, H.J. Lu wrote:
>>
>> There is one ICE:
>>
>> FAIL: gcc.dg/pr14963.c (internal compiler error)
>> FAIL: gcc.dg/pr14963.c (test for excess errors)
>>
>> It looks like a real bug.
>
> It is PR45062, it's just exposed by this patch because the problematic
> statement is parsed instead of skipped. ?So the ICE is "correct", it's an
> improvement in coverage.
>


Like this?

-- 
H.J.
---
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index c0d5a49..2b0c0e4 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -4046,7 +4046,11 @@ start_decl (struct c_declarator *declarator,
struct c_declspecs *declspecs,
       if (ce->kind == cdk_function)
 	{
 	  tree args = ce->u.arg_info->parms;
-	  for (; args; args = DECL_CHAIN (args))
+	  /* ARGS may contain a mixture of DECLs and TREE_LISTs due to
+	     invalid input, so be careful.  */
+	  for (; args; args = (DECL_P (args)
+			       ? DECL_CHAIN (args)
+			       : TREE_CHAIN (args)))
 	    {
 	      tree type = TREE_TYPE (args);
 	      if (type && INTEGRAL_TYPE_P (type)


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