[Issue 24411] [CODEGEN] bad shl codegen

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Feb 28 09:10:15 UTC 2024


https://issues.dlang.org/show_bug.cgi?id=24411

--- Comment #4 from anonymous4 <dfj1esp02 at sneakemail.com> ---
Shifts are often hardcoded. If you shift by untrusted amount, then you probably
have bit arrays, and if you use bit arrays with untrusted indexes, then you
need bound checking, not clear what you try to do, try
https://dlang.org/phobos/std_bitmanip.html#BitArray

AFAIK most processors simply mask the shift amount. If some processor traps on
overflow here, it would be safe, but probably not very useful for you.

--


More information about the Digitalmars-d-bugs mailing list