This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/78629] vec.h: null pointer passed as argument 1, which is declared to never be null
- From: "prathamesh3492 at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 01 Dec 2016 09:26:12 +0000
- Subject: [Bug middle-end/78629] vec.h: null pointer passed as argument 1, which is declared to never be null
- Auto-submitted: auto-generated
- References: <bug-78629-4@http.gcc.gnu.org/bugzilla/>
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