Page MenuHomePhabricator

Fix inline assembler constraint validation

Authored by joerg on Feb 25 2019, 3:23 PM.



The current constraint logic is both too lax and too strict. It fails for input outside the [INT_MIN..INT_MAX] range, but it also implicitly accepts 0 as value when it should not. Adjust logic to handle both correctly.

Diff Detail


Event Timeline

joerg created this revision.Feb 25 2019, 3:23 PM
compnerd accepted this revision.Feb 26 2019, 4:22 PM

Nice find!

This revision is now accepted and ready to land.Feb 26 2019, 4:22 PM
efriedma added inline comments.
860 ↗(On Diff #188265)

Isn't the "ImmSet.count" call still wrong? It looks like it crashes on an 128-bit immediate, and implicitly truncates a 64-bit immediate. I guess you could check Value.isSignedIntN(32)?

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptFeb 26 2019, 4:40 PM
joerg marked an inline comment as done.Feb 28 2019, 5:21 AM
joerg added inline comments.
860 ↗(On Diff #188265)

I've added that and a test case for truncation as a follow-up.