This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]