Re: [PHP-DEV] Weird bitset shift offset in zend_alloc

This is only part of a thread. view whole thread
March 6, 2019 08:14 (Stanislav Malyshev)

> But I'm not sure how it's supposed to work. Is it correct that on GCC > (and clang, presumably, since it defines __GNUC__) accept long bitshifts > and do the right thing with argument like 138? Is it documented > anywhere? Or is there a bug here? > > > This is a bug, yes. Oversize shifts are UB, and the only thing > preventing this from being miscompiled is the fact that the compiler > cannot figure out that the shift is oversized. > > I'm not sure why this code was introduced, as the compiler should > generally be able to eliminate this masking if it is unnecessary. See > for example these isel patterns in clang: >
This was introduced by Dmitry in, so I wonder how that code works in allocators... -- Stas Malyshev