Skip to content

System constant cannot be used as second assembly operand #359

Description

@erkyrath

In the line

 @add #strings_offset #code_offset -> val;

The first sysconstant #strings_offset is parsed correctly, but the second #code_offset is erroneously read as a regular symbol code_offset. This then generates a "No such constant" error.

I think the problem is that when the first operand is parsed (parse_operand_z() at asm.c:3601), the lexer looks ahead to the # token. Lexing this eats two tokens (expressp.c:380), but we then only put one back.

Really we could run into this problem any time a system constant follows another value with no delimiter. For example:

Array arr --> 1 2 #strings_offset 3 4;

You can work around the problem by writing the system constant in parens.

 @add #strings_offset (#code_offset) -> val;

Activity

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions