Skip to content

calling INT with float bounds results in a crash #26

Open

Description

@mzuenni

According to the spec this should be a valid program (even though kind of weird):

INT(-0.5, 0.5) NEWLINE

But I get:

terminate called after throwing an instance of 'boost::wrapexcept<boost::bad_get>'
  what():  boost::bad_get: failed value get using boost::get

Activity

  1. changed the title [-]calling INT results in a crash[/-] [+]calling INT with float bounds results in a crash[/+] on Mar 8, 2026
  2. mzuenni commented on Mar 9, 2026

    @mzuenni
    ContributorAuthor

    Using a float, or a string as an array index also seems to crash:

    SET(a[1.0]=1)
    
    SET(a[""]=1)
    
  3. eldering commented on Mar 14, 2026

    @eldering
    Member

    Indeed. The intention was that indices may be expressions, but must have integer type, but that's not made explicit in the specification. I think we should just make that explicit and also check and report better errors in your examples above.

  4. mzuenni commented on Mar 15, 2026

    @mzuenni
    ContributorAuthor

    For the indices I agree, but what is intended for INT?

    INT(-0.5, 0.5) NEWLINE
    

    Allowing or disallowing this would both be fine for me. (Currently checktestdata crashes => so its not allowed)

  5. eldering commented on Mar 15, 2026

    @eldering
    Member

    For the indices I agree, but what is intended for INT?

    INT(-0.5, 0.5) NEWLINE
    

    Allowing or disallowing this would both be fine for me. (Currently checktestdata crashes => so its not allowed)

    I think the implicit assumption was that min and max have integer type, so we should make that explicit and also make the error message more explicit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions