[Cython] overflow bug?

Jeroen Demeyer jdemeyer at cage.ugent.be
Sat Sep 5 11:53:03 CEST 2015


On 2015-09-05 11:22, Stefan Behnel wrote:
> Thanks for the report. Yes, the generated C code evaluates the shift
> operation in C space as
>
>       (1 << (__pyx_t_2 * 8))
>
> And yes, I consider this a bug. It's not entirely easy to find the right
> fix, though. I mean, the obvious thing to do would be to evaluate all
> left-shift operations in Python space, but that wouldn't be fast for the
> "normal" cases. Not sure if there's a point where to draw a line, though...

To me, it's not different than overflow when multiplying C integers. So 
I don't really consider it a bug. It is something which could be dealt 
with by the overflowcheck directive.



More information about the cython-devel mailing list