#20 ✓resolved
Douglas Creager

Test failures when using Bison 2.3

Reported by Douglas Creager | March 2nd, 2009 @ 02:11 PM | in 1.0-α4

On my Ubuntu Intrepid system, I get five test failures when building the csp0 library:

         41 - csp:compile:00-repl-intchoice0 (Failed)
        118 - csp:prenormalize-t:00-repl-intchoice0 (Failed)
        119 - csp:prenormalize-f:00-repl-intchoice0 (Failed)
        246 - csp:normalize-t:00-repl-intchoice0 (Failed)
        247 - csp:normalize-f:00-repl-intchoice0 (Failed)

On my Mac OS box, all tests pass.

It turns out these are currently the only tests that are supposed to cause a parse error. The error message that the testing harness expects includes the position of the syntax error in the input .csp0 file.

It looks like between Bison 2.3 (the version in Ubuntu) and 2.4.1 (the version in MacPorts), the Bison developers changed the position class. In 2.3, the column numbers are 0-based; in 2.4.1, they're 1-based. In both versions, line numbers are 1-based. This discrepancy means that with 2.3, the error message printed out by the CSP₀ compiler doesn't match what the test harness expects.

Comments and changes to this ticket

  • Douglas Creager

    Douglas Creager March 2nd, 2009 @ 02:40 PM

    More information. The position class is defined by /usr/share/bison/location.cc. In 2.3, the default constructor uses a hard-coded 0 for the initial value of the column field. In 2.4, this is configured by the b4_location_initial_column M4 variable, which is given an default value of 1 in /usr/share/bison/bison.m4.

  • Douglas Creager

    Douglas Creager March 2nd, 2009 @ 02:55 PM

    Here is a thread on the Bison mailing list describing the change:

    http://www.mail-archive.com/bison-patches@gnu.org/msg01142.html

  • Douglas Creager

    Douglas Creager March 2nd, 2009 @ 03:58 PM

    • State changed from “new” to “open”
    • Milestone set to 1.0-α4
  • Douglas Creager

    Douglas Creager March 2nd, 2009 @ 04:16 PM

    • State changed from “open” to “resolved”

    (from [cfbf8e98479f1270f396db888adb9a01c8bc60dc]) Fixed column numbers when using Bison 2.3

    Bison 2.3 numbers the columns in an input file from 0, whereas 2.4 numbers them from 1. We want to consistently use 1-based column numbers. This was causing a problem with test cases that would generate (expected) parse errors — if the correct test result was generated using Bison 2.4, then that test would fail when using 2.3, and vice versa.

    I could not find an easy way to override the “column” field's default value, so instead, we add code in our Bison grammars to manually reset the column to 1 at the start of each file, and every time a new line is encountered.

    Lighthouse: [#20 state:resolved] http://github.com/hst/hst/commit...

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

An open-source refinement checker for the CSP process algebra.

People watching this ticket

Tags

Referenced by

Pages