VanL / shedskin

Shed Skin is an experimental compiler, that can translate pure, but implicitly statically typed Python (2.4-2.6) programs into optimized C++
0 stars 1 forks source link

array with 'L' and 'I' types is not correct #160

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When I use code like:
array('I', [1, 3, 4294967294])
shedskin generates code:
list<__ss_int>(3,1,3,4294967294)

But __ss_int is not unsigned type and I get warning from g++ and errors in 
output:
array('L', [1, 3, -1])

Shedskin version 0.8, Ubuntu 10.04
Sorry, if you already had fixed it in 0.9 (I haven't deb for this version).

Original issue reported on code.google.com by serg.kogrom@gmail.com on 6 Nov 2011 at 2:51

GoogleCodeExporter commented 9 years ago
thanks a lot for reporting! :) I will have a look at this soon..

Original comment by mark.duf...@gmail.com on 6 Nov 2011 at 7:23

GoogleCodeExporter commented 9 years ago
are you sure the output is not 'array('I', [1, 3, -2])'.. ? if this is the 
output, I don't think there's a problem, really. integers after compilation are 
32-bit signed, so -2 is actually the same as 4294967294.. if you use shedskin 
-l, integers become 64-bit signed, and it actually outputs 4294967294 here. I 
just tested this on a 64-bit system.. will see what happens on my 32-bit home 
pc later.

Original comment by mark.duf...@gmail.com on 8 Nov 2011 at 11:27

GoogleCodeExporter commented 9 years ago
sorry for the delay. I had a look at this on 32-bit as well, and it looks fine 
there too. I understand this may be a bit confusing.

Original comment by mark.duf...@gmail.com on 16 Dec 2011 at 10:16