------- Comment #3 from attardi at di dot unipi dot it 2010-08-10 10:27 ------- You are right. SWIG does this on purpose, as the most portable way to cast a pointer into a 64 bit integer:
"For non-primitive types the "in" and "out" typemaps are responsible for casting between the C/C++ pointer and the 64 bit jlong type. There is no portable way to cast a pointer into a 64 bit integer type and the approach taken by SWIG is mostly portable, but breaks C/C++ aliasing rules." http://www.swig.org/Doc1.3/Java.html#typemaps_c_to_java_types -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45246