Skip to content

Conversation

@mstorsjo
Copy link
Member

@mstorsjo mstorsjo commented Nov 7, 2025

It turns out that rc.exe doesn't interpret integer literals as octal numbers - but GNU windres does. Previously, llvm-rc did interpret them as octal.

Fix the issue by stripping away the leading zeros during tokenization. The alternative (which would be somewhat cleaner, as visible in tokenizer.test) would be to retain them in the RCToken object, but strip them out before calling
StringRef::getAsInteger. Alternatively to handle the radix detection locally in llvm-rc code and not rely on getAsInteger to autodetect it. Both of those solutions require propagating the IsWindres flag so that it is available within RCToken, or at least when calling RCToken::intValue().

Fixes: #144723

… mode

It turns out that rc.exe doesn't interpret integer literals as
octal numbers - but GNU windres does. Previously, llvm-rc did
interpret them as octal.

Fix the issue by stripping away the leading zeros during
tokenization. The alternative (which would be somewhat cleaner,
as visible in tokenizer.test) would be to retain them in the
RCToken object, but strip them out before calling
StringRef::getAsInteger. Alternatively to handle the radix
detection locally in llvm-rc code and not rely on getAsInteger
to autodetect it. Both of those solutions require propagating
the IsWindres flag so that it is available within RCToken, or at
least when calling RCToken::intValue().

Fixes: llvm#144723
Copy link
Member

@aganea aganea left a comment

Choose a reason for hiding this comment

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

LGTM. Does this deserve a release notes entry?

@mstorsjo
Copy link
Member Author

mstorsjo commented Nov 7, 2025

LGTM. Does this deserve a release notes entry?

Not sure; I guess this is a fairly obscure bugfix...

What do you think about backporting this to 21.x? It's a quite safe change to make, but we're also quite late in the 21.x cycle.

@aganea
Copy link
Member

aganea commented Nov 8, 2025

LGTM. Does this deserve a release notes entry?

Not sure; I guess this is a fairly obscure bugfix...

What do you think about backporting this to 21.x? It's a quite safe change to make, but we're also quite late in the 21.x cycle.

Yes we can port it.

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.

llvm-rc fails to parse FILEVERSION 16bit values

2 participants