]> granicus.if.org Git - re2c/commitdiff
Do not access vector element by reference that is invalidated due to reallocation.
authorUlya Trofimovich <skvadrik@gmail.com>
Tue, 5 Mar 2019 22:35:23 +0000 (22:35 +0000)
committerUlya Trofimovich <skvadrik@gmail.com>
Tue, 5 Mar 2019 22:44:21 +0000 (22:44 +0000)
re2c/src/dfa/closure_posix.h
re2c/src/dfa/determinization.cc

index b598d176f497bb3691b0eb53987ca2e0889b8668..d767f30cd87ead7ba3465d8546cd91022baf4d84 100644 (file)
@@ -145,7 +145,7 @@ bool scan(ctx_t &ctx, nfa_state_t *q, bool all)
     bool any = false;
 
     typedef typename ctx_t::conf_t conf_t;
-    const conf_t &x = ctx.state[q->clos];
+    const conf_t x = ctx.state[q->clos];
 
     switch (q->type) {
         case nfa_state_t::NIL:
@@ -253,7 +253,7 @@ void closure_posix_gtop(ctx_t &ctx)
         DINCCOUNT_CLSCANS(ctx);
 
         typedef typename ctx_t::conf_t conf_t;
-        const conf_t &x = ctx.state[q->clos];
+        const conf_t x = ctx.state[q->clos];
 
         switch (q->type) {
             case nfa_state_t::NIL:
index 879db8c3f97d881127ddae06e9cccd3491b76b77..2b9e919f40452382f03da8990f980e645f9059ed 100644 (file)
@@ -278,6 +278,9 @@ determ_context_t<SEMA>::determ_context_t(const opt_t *opts, Msg &msg
     const size_t ncores = nfa.ncores;
     const size_t ntags = nfa.tags.size();
 
+    reach.reserve(nstates);
+    state.reserve(nstates);
+
     dc_hc_caches.resize(ntags);
     dc_path1.reserve(ntags);
     dc_path2.reserve(ntags);