Unsigned shift of signed value during optimized signed divide that is only valid because of additional multiplication fails to simplify

Offen
#4,366 0 Kommentare 3 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
32/100
Issue-Typ
Bug
Klarheit
Muss geklärt werden
Aktivitätsstatus
Veraltet
Tech-Stack
cpp

Rechercherichtung

Start with the unsigned_shift.zip examples, especially the cases involving 12, 24, 36, and 48, and trace how Binary Ninja simplifies the optimized divide and modulus. The issue is resolved when these patterns simplify correctly despite the intermediate signed-division result being invalid on its own.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Component: Core Core: HLIL Effort: Low IL Optimization Impact: Low

Sometimes the compiler can emit a pattern for optimized modulus where the optimized division component of the modulus
is not valid on its own. It can use an unsigned shift by a small amount during a signed division, which normally would
cause the result to be incorrect, but it can be correct if that result is later multiplied by a value, causing all
values to produce the correct result.

Because Binary Ninja first simplifies the optimized divide, then simplifies the modulus, it cannot simplify the
expression at all.

unsigned_shift

Binary with examples:

unsigned_shift.zip

See 12, 24, 36, 48, and others.

Vorherrschende Sprache
C++
Sterne
1.3k
Forks
298
Ø Merge
5 T. 5 Std.
Gemergte PRs (30 T.)
19

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus Vector35/binaryninja-api

Alle Issues in Vector35/binaryninja-api

Ähnliche Issues

Weitere Issues zu C++

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.