Hi,
genmatch segfaults on:
(define_operator_list op (plus))

The above syntax is invalid, and it segfaults on:
fatal_error (token, "operator list is empty");
because token is NULL.

The patch puts a check for CPP_CLOSE_PAREN after parsing id-list.
OK for trunk after bootstrap+testing completes ?

Thanks,
Prathamesh
Index: genmatch.c
===================================================================
--- genmatch.c  (revision 223294)
+++ genmatch.c  (working copy)
@@ -3427,6 +3427,11 @@
        op->substitutes.safe_push (idb);
     }
 
+  // Check that there is no junk after id-list
+  token = peek();
+  if (token->type != CPP_CLOSE_PAREN)
+    fatal_at (token, "expected identifier got %s", cpp_type2name (token->type, 
0));
+
   if (op->substitutes.length () == 0)
     fatal_at (token, "operator-list cannot be empty");
 
2015-05-19  Prathamesh Kulkarni  <prathamesh.kulka...@linaro.org>

        * genmatch.c (parser::parse_operator_list): Check for CPP_CLOSE_PAREN 
after end of id-list.

Reply via email to