python-to-c++ compiler under wine
Mark Dufour
mark.dufour at gmail.com
Fri Jan 12 06:41:08 CST 2007
hi there,
while trying to get an experimental python-to-c++ compiler
(http://mark.dufour.googlepages.com) to run under wine, I found a
not-so complicated test case that crashes. it is a simple C++ program,
converted from 57 lines of Python. it is quite self-contained, and
only uses the Boehm GC, but it crashes early and consistently. I
corresponded with mike hearn about this, but he is too busy atm to
look at it further. here is a mail of me to him, with a link to an
archive with an .exe that crashes (but works under windows), the .py
and .?pp source code, and a crash log with debugging symbols. it would
be great if any of you here would have a look at it.
---
I tried to minimize the test program so it still crashes. the
attachment (t37.py, 56 lines) very quickly and consistently crashes
when trying to print out a list of integers:
def propagate(lit, mods, failed_literal=0):
..
print 'prop', lit
print occurrence[3]
this happens after calling just a few functions (solve_rec, lookahead,
lookahead_variable, propagate) and no backtracking.
in C++ terms, occurrence is a list<list<list<int> *> *> *.
occurrence[3] is then a list<list<int> *> *. occurrence[3] is a list
of 6 'clauses'. it always goes wrong on printing the 3rd clause (or
list<int> *), at the line 'r->unit += repr.. ' below, in the file
builtin.hpp:
template<class T> str *list<T>::__repr__() {
str *r = new str("[");
for(int i = 0; i<this->__len__();i++) {
r->unit += repr(units[i])->unit;
if (i<this->__len__()-1)
r->unit += ", ";
}
r->unit += "]";
return r;
}
now what happens in repr(..) is a bit complicated because of templatry
and va_args stuff and all, but I would think that if the clause is not
corrupt it should just work..
btw. a list<T> uses a vector<T> in it called 'units', as can be seen above.
here's a bundle of files (crash log, t37.py, t37.?pp, t37.exe..):
http://mark.dufour.googlepages.com/shedskin_crash.tgz
---
thanks for any help!
mark dufour.
--
"One of my most productive days was throwing away 1000 lines of code"
- Ken Thompson
More information about the wine-devel
mailing list