[match-and-simplify] report error for invalid operator-lists
Prathamesh Kulkarni
prathamesh.kulkarni@linaro.org
Mon May 18 23:26:00 GMT 2015
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
-------------- next part --------------
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");
-------------- next part --------------
2015-05-19 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
* genmatch.c (parser::parse_operator_list): Check for CPP_CLOSE_PAREN after end of id-list.
More information about the Gcc-patches
mailing list