Skip to content

Conversation

@tlively
Copy link
Member

@tlively tlively commented May 27, 2022

Previously we were tracking whether integer tokens were signed but we did not
differentiate between positive and negative signs. Unfortunately, without
differentiating them, there's no way to tell the difference between an in-bounds
negative integer and a wildly out-of-bounds positive integer when trying to
perform bounds checks for s32 tokens. Fix the problem by tracking not only
whether there is a sign on an integer token, but also what the sign is.

Previously we were tracking whether integer tokens were signed but we did not
differentiate between positive and negative signs. Unfortunately, without
differentiating them, there's no way to tell the difference between an in-bounds
negative integer and a wildly out-of-bounds positive integer when trying to
perform bounds checks for s32 tokens. Fix the problem by tracking not only
whether there is a sign on an integer token, but also what the sign is.
@tlively tlively requested review from aheejin and kripken May 27, 2022 23:04
@tlively tlively merged commit 838de5c into main May 27, 2022
@tlively tlively deleted the trinary-sign branch May 27, 2022 23:58
};

enum Signedness { Unsigned, Signed };
enum Sign { NoSign, Pos, Neg };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any reason we need to have both NoSign and Pos? Can't we make the default Pos, and change it to Neg only when we take -?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm nevermind. We need to distinguish u32 vs. s32...

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants