From: Richard Biener Date: Wed, 5 Oct 2016 11:58:25 +0000 (+0000) Subject: re PR middle-end/77863 (genmatch segfault on a wrong usage of an for operator) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=496326bcc14616ae90da47db7a7f203d79f02923;p=gcc.git re PR middle-end/77863 (genmatch segfault on a wrong usage of an for operator) 2016-10-05 Richard Biener PR middle-end/77863 * genmatch.c (capture_info::walk_c_expr): Diagnose unknown capture ids in c-exprs. From-SVN: r240777 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 43858919d12..4fcd8f5b69e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-10-05 Richard Biener + + PR middle-end/77863 + * genmatch.c (capture_info::walk_c_expr): Diagnose unknown + capture ids in c-exprs. + 2016-10-05 Richard Biener PR middle-end/77826 diff --git a/gcc/genmatch.c b/gcc/genmatch.c index 5883ba39420..de03d34a6b3 100644 --- a/gcc/genmatch.c +++ b/gcc/genmatch.c @@ -2194,8 +2194,10 @@ capture_info::walk_c_expr (c_expr *e) id = (const char *)n->val.str.text; else id = (const char *)CPP_HASHNODE (n->val.node.node)->ident.str; - unsigned where = *e->capture_ids->get(id); - info[info[where].same_as].force_no_side_effects_p = true; + unsigned *where = e->capture_ids->get(id); + if (! where) + fatal_at (n, "unknown capture id '%s'", id); + info[info[*where].same_as].force_no_side_effects_p = true; if (verbose >= 1 && !gimple) warning_at (t, "capture escapes");