Skip to content

Conversation

@tromey
Copy link
Contributor

@tromey tromey commented Feb 7, 2025

I noticed that DIEInteger::BestForm used a cast to char:

  if ((char)Int == SignedInt)

If 'char' happens to be unsigned, this will not behave correctly. Then I also noticed that this code assumes the size of 'short' and 'int'.

This patch changes this code to use more precise types. No functional change should be visible on ordinary hosts.

I noticed that DIEInteger::BestForm used a cast to char:

      if ((char)Int == SignedInt)

If 'char' happens to be unsigned, this will not behave correctly.
Then I also noticed that this code assumes the size of 'short' and
'int'.

This patch changes this code to use more precise types.  No functional
change should be visible on ordinary hosts.
@tromey
Copy link
Contributor Author

tromey commented Feb 19, 2025

@dwblaikie this is another DWARF-related patch that didn't get properly labelled by the bot.

@dwblaikie dwblaikie merged commit c0a6f7a into llvm:main Feb 21, 2025
8 checks passed
@tromey tromey deleted the die-cast-types branch February 21, 2025 21:22
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.

2 participants