This is an archive of the discontinued LLVM Phabricator instance.

[clang][Interp] Make sure we push integers of the correct size
ClosedPublic

Authored by tbaeder on Jul 18 2023, 2:16 AM.

Details

Summary
Integers might not be 32 bits wide, so check the TargetInfo for their
size.

Diff Detail

Event Timeline

tbaeder created this revision.Jul 18 2023, 2:16 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 18 2023, 2:16 AM
tbaeder requested review of this revision.Jul 18 2023, 2:16 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 18 2023, 2:16 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
aaron.ballman accepted this revision.Jul 18 2023, 7:25 AM

LGTM as far as the changes go, but did have a question about whether we need this for unsigned values as well.

clang/lib/AST/Interp/InterpBuiltin.cpp
36

Do we need the same for unsigned int as well? (I'm thinking in terms of pushing literal values like 0U)

This revision is now accepted and ready to land.Jul 18 2023, 7:25 AM
tbaeder added inline comments.Jul 18 2023, 8:07 AM
clang/lib/AST/Interp/InterpBuiltin.cpp
36

Theoretically yes, but all the ints we're pushing right now are signed AFAICS.

This patch is missing the Ret<PT_Sint32> part in InterpBuiltin() in the same file. That needs to change to the correct type as well.

I can do that in a follow-up commit. @aaron.ballman Can you come up with a value I can pass to -triple so I can actually test that this works?

tbaeder updated this revision to Diff 543320.Jul 23 2023, 12:56 PM
tbaeder updated this revision to Diff 543321.Jul 23 2023, 12:57 PM

This patch is missing the Ret<PT_Sint32> part in InterpBuiltin() in the same file. That needs to change to the correct type as well.

I can do that in a follow-up commit. @aaron.ballman Can you come up with a value I can pass to -triple so I can actually test that this works?

Oops, sorry on the delayed response, this one slipped under my radar. You should be able to use avr-unknown-unknown: https://godbolt.org/z/4TsPW41d5

tbaeder updated this revision to Diff 545349.Jul 29 2023, 2:04 AM

This patch is missing the Ret<PT_Sint32> part in InterpBuiltin() in the same file. That needs to change to the correct type as well.

I can do that in a follow-up commit. @aaron.ballman Can you come up with a value I can pass to -triple so I can actually test that this works?

Oops, sorry on the delayed response, this one slipped under my radar. You should be able to use avr-unknown-unknown: https://godbolt.org/z/4TsPW41d5

Thanks, updated with the avr RUN lines.

This revision was landed with ongoing or failed builds.Aug 17 2023, 1:36 AM
This revision was automatically updated to reflect the committed changes.

Breaks the bot https://lab.llvm.org/buildbot/#/builders/74/builds/21336/steps/13/logs/stdio

Please take a look or revert?

Note: msan_track_origins step may have useful details.

This revision is now accepted and ready to land.Aug 17 2023, 6:11 PM

Breaks the bot https://lab.llvm.org/buildbot/#/builders/74/builds/21336/steps/13/logs/stdio

Please take a look or revert?

Note: msan_track_origins step may have useful details.

Wow, sorry. That was too late in my day. I have a pretty good idea of why it's failing but I'll try to reproduce with an msan enabled build.