Skip to content

Conversation

@kripken
Copy link
Member

@kripken kripken commented Aug 31, 2018

The change means that nan values will be compared bitwise when writing A == B, and so the float rule of a nan is different from itself would not apply.

I think this is a safer default. In particular this PR fixes a fuzz bug in the rse pass, which placed Literals in a hash table, and due to nan != nan, an infinite loop... Also, looks like we really want a bitwise comparison pretty much everywhere anyhow, as can be seen in the diff here. Really the single place we need a floaty comparison is in the intepreter where we implement f32.eq etc., and there the code was already using the proper code path anyhow.

…s Literals work properly in hashtables, fixing an infinite loop fuzz bug in the rse pass
src/literal.h Outdated
bool bitwiseEqual(const Literal& other) const;
// Compare in a non-bitwise manner, which means for a nan a we have
// a != a
bool nonBitwiseEqual(const Literal& other) const;
Copy link
Member

Choose a reason for hiding this comment

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

This is just a little ambiguous whether the 'non' means 'not bitwise' or 'not equal'. Maybe 'typedEqual' or something like that would indicate what it is, rather than what it isn't?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point, yeah.

I realized now that we don't need this function, actually - as the one place that needs it uses the existing .eq() calls (which have always been typed). So I removed this confusing function, and added comments to clarify how those other ones work.

@kripken kripken merged commit a852156 into master Sep 1, 2018
@kripken kripken deleted the rse-nan branch September 1, 2018 16:59
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.

3 participants