Here's the story: Your GCC 3.4 is compliant to the existing ISO C++
standard, but the proposed C++0x standard allows compilers to
optionally support the reinterpret_cast in question. The C++98 and C++03 Standards (see section 5.2.10) do not allow reinterpret_cast<void*>(functionPointer). But the ability to do this is important for a lot of practical uses, including Unix and Windows APIs. Soon after the C++98 Standard was approved, a language defect report was filed on this topic, and can be found at http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#195. The result is that compilers will be allowed to support reinterpret_cast conversions of function points to other types, though such support is not guaranteed to be supported by all compilers. So, strictly speaking, the JIT code is dependent on compiler behavior that isn't portable and doesn't exist in any certified standard. But it works with all -current- compilers I'm aware of (GCC 4.x, VC++, CodeWarrior, IBM, EDG-based). If you need to stick with GCC 3.4, I suggest you switch the casts to a C cast, possibly by doing an intermediate cast to uintptr_t. If there is a lot of code to convert, I might suggest creating this: template<typname T> void* function_ptr_cast(T t) { return (void*)t; // Or something more drastic to coerce the compiler } and doing a search and replace of the affected reinterpret_cast uses with function_ptr_cast. This ought to be fairly maintainable between trunk syncs. Paul the JIT does some 'forbidden stuff'. i use gcc-3.4.6 on linux 2.6.28This works correctly with newer versions of GCC. I know that GCC 4.0 and 4.2 handle this code correctly. I'd suggest that you update your compiler or disable the JIT. It's probably worth filing a bug report in Bugzilla about the problem as well so we can tweak the configuration such that the JIT is disabled for GCC versions that cannot handle it. |
_______________________________________________ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev