Message ID | CAAgBjMn0VgYL9HV+8xiqihO9nzN_Y0HB9KDjmbQ+P=vSdRJjCg@mail.gmail.com |
---|---|
State | New |
Headers | show |
On Tue, 19 May 2015, Prathamesh Kulkarni wrote: > 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 ? Ok. Thanks, Richard.
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");