From 82841af7d05fd59204a55dd3c3669b7154a4d2b5 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Sun, 27 Jan 2002 13:57:17 +0000 Subject: [PATCH] Fix `%nonassoc and eof'. * src/state.c (errs_dup): Aaaah! The failure was due to bytes which were not properly copied! Replace memcpy (res->errs, src->errs, src->nerrs); with memcpy (res->errs, src->errs, src->nerrs * sizeof (src->errs[0])); !!! * tests/regression.at (%nonassoc and eof): Adjust to newest Autotest: `.' is not in the PATH. --- ChangeLog | 13 +++++++++++++ src/LR0.c | 4 ++-- src/state.c | 2 +- tests/regression.at | 10 +++++----- 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index e9876f3d..06216c55 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2002-01-27 Akim Demaille + + Fix `%nonassoc and eof'. + + * src/state.c (errs_dup): Aaaah! The failure was due to bytes + which were not properly copied! Replace + memcpy (res->errs, src->errs, src->nerrs); + with + memcpy (res->errs, src->errs, src->nerrs * sizeof (src->errs[0])); + !!! + * tests/regression.at (%nonassoc and eof): Adjust to newest + Autotest: `.' is not in the PATH. + 2002-01-27 Akim Demaille * tests/sets.at (AT_EXTRACT_SETS): New. diff --git a/src/LR0.c b/src/LR0.c index e914c6ef..6a911f24 100644 --- a/src/LR0.c +++ b/src/LR0.c @@ -364,9 +364,9 @@ save_reductions (void) } -/*--------------------. +/*---------------. | Build STATES. | -`--------------------*/ +`---------------*/ static void set_states (void) diff --git a/src/state.c b/src/state.c index a1e83f38..b8c647e8 100644 --- a/src/state.c +++ b/src/state.c @@ -61,7 +61,7 @@ errs * errs_dup (errs *src) { errs *res = errs_new (src->nerrs); - memcpy (res->errs, src->errs, src->nerrs); + memcpy (res->errs, src->errs, src->nerrs * sizeof (src->errs[0])); return res; } diff --git a/tests/regression.at b/tests/regression.at index 4a17ffa6..ebe240c0 100644 --- a/tests/regression.at +++ b/tests/regression.at @@ -75,20 +75,20 @@ main (int argc, const char *argv[]) AT_CHECK([bison input.y -o input.c]) AT_CHECK([$CC $CFLAGS $CPPFLAGS input.c -o input], 0, [], [ignore]) -AT_CHECK([input '0<0']) +AT_CHECK([./input '0<0']) # FIXME: This is an actual bug, but a new one, in the sense that # no one has ever spotted it! The messages are *wrong*: there should # be nothing there, it should be expected eof. -AT_CHECK([input '0<0<0'], [1], [], +AT_CHECK([./input '0<0<0'], [1], [], [parse error, unexpected '<', expecting '<' or '>' ]) -AT_CHECK([input '0>0']) -AT_CHECK([input '0>0>0'], [1], [], +AT_CHECK([./input '0>0']) +AT_CHECK([./input '0>0>0'], [1], [], [parse error, unexpected '>', expecting '<' or '>' ]) -AT_CHECK([input '0<0>0'], [1], [], +AT_CHECK([./input '0<0>0'], [1], [], [parse error, unexpected '>', expecting '<' or '>' ]) -- 2.45.2