Skip to content

Test/fix h_bits(0, ...)

Sven M. Hallberg requested to merge pesco/hammer:fix-h_bits_0 into master

I wanted to know how h_bits() behaves for an argument of 0, so I added the following test:

  const HParser *bits0_ = h_sequence(h_bits(0, false), h_ch('a'), NULL);
  g_check_parse_match(bits0_, (HParserBackend)GPOINTER_TO_INT(backend), "a", 1, "(u0 u0x61)");

This passes with packrat and regular but results in a segfault for all of PB_LLk, PB_LALR, and PB_GLR.

Platform: OpenBSD 6.6 GENERIC.MP#316 with GCC 8.3.0 and clang 8.0.1.

Core dump (GCC): test_suite.core

PS: While at it, I also added tests with 3 and 9 bits. Since the CF backends only support byte-level operation so far, I commented that case out for them.

Edited by Sven M. Hallberg

Merge request reports