[Bug middle-end/78629] vec.h: null pointer passed as argument 1, which is declared to never be null

prathamesh3492 at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Dec 1 09:26:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78629

--- Comment #1 from prathamesh3492 at gcc dot gnu.org ---
This slight change to finish_match_operand() fixes the error, but not
sure if it's correct.

diff --git a/gcc/genmatch.c b/gcc/genmatch.c
index 41951c5..3ff5bdf 100644
--- a/gcc/genmatch.c
+++ b/gcc/genmatch.c
@@ -4798,7 +4798,10 @@ parser::finish_match_operand (operand *op)
   /* Look for matching captures, diagnose mis-uses of @@ and apply
      early lowering and distribution of value_match.  */
   auto_vec<vec<capture *> > cpts;
-  cpts.safe_grow_cleared (capture_ids->elements ());
+  cpts.reserve (capture_ids->elements ());
+  for (unsigned i = 0; i < capture_ids->elements (); ++i)
+    cpts.quick_push (vNULL);
+
   walk_captures (op, cpts);
   for (unsigned i = 0; i < cpts.length (); ++i)
     {

Thanks,
Prathamesh


More information about the Gcc-bugs mailing list