Skip to content

Conversation

@froydnj
Copy link
Contributor

@froydnj froydnj commented Oct 15, 2025

cc @Earlopain

I think this resolves the problem that #3681 was attempting to find -- shifting a signed integer in such a way that the sign bit changes is undefined behavior. So if token->type is 31, 1 << 31 is actually undefined.

Forcing the constant to be unsigned should fix this, and is good for consistency because the table we're masking against is full of unsigned integers anyway. I went ahead and changed the table initialization out of an abundance of caution, since we might have one of those token values be 31 someday; happy to undo that one if you like.

@kddnewton kddnewton merged commit 4848dbd into ruby:main Oct 15, 2025
60 checks passed
@kddnewton kddnewton mentioned this pull request Oct 15, 2025
@Earlopain
Copy link
Contributor

Thanks @froydnj! I don't have a super obvious way to test this, when the next version releases I can know for sure.

@froydnj
Copy link
Contributor Author

froydnj commented Oct 16, 2025

Is it easy to figure out what compiler and version is being used in selenium-webdriver CI @Earlopain ? If you knew that (and ideally the compiler options they are using aren't too hard to figure out either), you could run smaller test cases through https://gcc.godbolt.org .

@Earlopain
Copy link
Contributor

Earlopain commented Oct 16, 2025

It's some bazel setup which I don't want to mess with too much. I gave a quick look through the build logs but nothing stood out to me. It can't be anything too exotic since I could swear I've seen this warning myself in the past.

@Earlopain
Copy link
Contributor

Looks like this was exactly what was needed, their build goes fine now

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