re PR middle-end/77863 (genmatch segfault on a wrong usage of an for operator)
authorRichard Biener <rguenther@suse.de>
Wed, 5 Oct 2016 11:58:25 +0000 (11:58 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 5 Oct 2016 11:58:25 +0000 (11:58 +0000)
2016-10-05  Richard Biener  <rguenther@suse.de>

PR middle-end/77863
* genmatch.c (capture_info::walk_c_expr): Diagnose unknown
capture ids in c-exprs.

From-SVN: r240777

gcc/ChangeLog
gcc/genmatch.c

index 43858919d1256812125010636efdb2a7c71de95d..4fcd8f5b69ec96acfa225cc0096b4ccb6ba92c14 100644 (file)
@@ -1,3 +1,9 @@
+2016-10-05  Richard Biener  <rguenther@suse.de>
+
+       PR middle-end/77863
+       * genmatch.c (capture_info::walk_c_expr): Diagnose unknown
+       capture ids in c-exprs.
+
 2016-10-05  Richard Biener  <rguenther@suse.de>
 
        PR middle-end/77826
index 5883ba39420f34f9d6ee36eb3ba5ff5474cd5a0a..de03d34a6b344eb8767587881071b8d921d7f256 100644 (file)
@@ -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");