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

print arithmetic statement produces invalid code, crashes #81

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
print 0xedb88320 & 0xffffffff

leads to:
g++  -O0 -pipe -Wno-deprecated  -I. 
-I/usr/lib64/python2.6/site-packages/shedskin/lib 
/usr/lib64/python2.6/site-packages/shedskin/lib/builtin.cpp bug01.cpp 
/usr/lib64/python2.6/site-packages/shedskin/lib/re.cpp -lgc -lpcre  -o bug01
bug01.cpp: In function ‘void __bug01__::__init()’:
bug01.cpp:11:48: warning: ISO C++ says that these are ambiguous, even though 
the worst conversion for the first is better than the worst conversion for the 
second:
/usr/lib64/python2.6/site-packages/shedskin/lib/builtin.hpp:899:6: note: 
candidate 1: void __shedskin__::print2(__shedskin__::file*, int, int, ...)
/usr/lib64/python2.6/site-packages/shedskin/lib/builtin.hpp:898:6: note: 
candidate 2: void __shedskin__::print2(int, int, ...)
./bug01
make: *** [run] Segmentation fault

This is with latest trunk shedskin, cpython 2.6.5 on Gentoo ~amd64.

GNU gdb (Gentoo 7.1 p1) 7.1
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.gentoo.org/>...
Reading symbols from /home/wolf/shedskin_bug01/bug01...done.
(gdb) start
Temporary breakpoint 1 at 0x424d1c: file bug01.cpp, line 17.
Starting program: /home/wolf/shedskin_bug01/bug01 
warning: no loadable sections found in added symbol-file 
/home/system/usr_lib_debug/lib64/ld-2.11.2.so.debug
warning: no loadable sections found in added symbol-file 
/home/system/usr_lib_debug/usr/lib64/libgc.so.1.0.3.debug
warning: no loadable sections found in added symbol-file 
/home/system/usr_lib_debug/lib64/libpcre.so.0.0.1.debug
warning: no loadable sections found in added symbol-file 
/home/system/usr_lib_debug/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.1-pre9999/libstdc
++.so.6.0.14.debug

Temporary breakpoint 1, main () at bug01.cpp:17
17          __shedskin__::__init();
(gdb) c
Continuing.

Program received signal SIGSEGV, Segmentation fault.
0x000000000040da8e in __shedskin__::print2 (f=0x0, comma=1, n=-306674912) at 
/usr/lib64/python2.6/site-packages/shedskin/lib/builtin.cpp:2115
2115             f->print_lastchar = ' ';
(gdb) quit

Original issue reported on code.google.com by zeev.tar...@gmail.com on 15 Jun 2010 at 2:52

GoogleCodeExporter commented 9 years ago
thanks! even though the result will be wrong, it shouldn't crash I guess.. :) 
again, using shedskin -l, it works fine.

Original comment by mark.duf...@gmail.com on 15 Jun 2010 at 3:00

GoogleCodeExporter commented 9 years ago
crash fixed in GIT (gitorious.org/shedskin). thanks again for reporting!

Original comment by mark.duf...@gmail.com on 2 Jul 2010 at 2:11