glr2.cc: provide glr_state with a genuine copy-constructor
commitbaea8cf9fab4d922a0759507b6f570bdeb8374ef
authorAkim Demaille <akim.demaille@gmail.com>
Fri, 25 Dec 2020 08:13:46 +0000 (25 09:13 +0100)
committerAkim Demaille <akim.demaille@gmail.com>
Fri, 25 Dec 2020 10:04:53 +0000 (25 11:04 +0100)
treec1fc14bf3aadd1b17184501efd497c87217f463e
parent636c9a8042787d0c790d676595f3d56e672ce9f5
glr2.cc: provide glr_state with a genuine copy-constructor

The copy constructor was (lazily) implemented by a call to copyFrom.
Unfortunately copyFrom reads yyresolved from the destination (and
source), and in the case of the copy-ctor this is random garbagge,
which UBSAN catches:

    glr-regr2a.cc:1072:10: runtime error: load of value 7, which is not a valid value for type 'bool'

Rather than defining yyresolved before calling copyFrom, let's just
provide a genuine cpy-ctor for glr_state.

* data/skeletons/glr2.cc (glr_state::glr_state): Implement properly.
data/skeletons/glr2.cc