[Bug c++/45246] optimizer dereference

2010-08-10 Thread schwab at linux-m68k dot org
--- Comment #5 from schwab at linux-m68k dot org 2010-08-10 12:42 --- The most portable way to put a pointer value in a jlong is a = (uintptr_t)arg. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45246

[Bug c++/45246] optimizer dereference

2010-08-10 Thread pinskia at gmail dot com
--- Comment #4 from pinskia at gmail dot com 2010-08-10 12:36 --- Subject: Re: New: optimizer dereference On Aug 10, 2010, at 1:00 AM, "attardi at di dot unipi dot it" wrote: > Code produced using -O2 handles dereferencing incorrectly. > Here is a program that shows the bug: > > #

[Bug c++/45246] optimizer dereference

2010-08-10 Thread attardi at di dot unipi dot it
--- 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

[Bug c++/45246] optimizer dereference

2010-08-10 Thread rguenth at gcc dot gnu dot org
--- Comment #2 from rguenth at gcc dot gnu dot org 2010-08-10 08:54 --- void* baseptr = 0; *(std::vector **)&baseptr = (Derived *)arg; you are accessing an object of type void* via an lvalue of type std::vector *. -- rguenth at gcc dot gnu dot org changed: What

[Bug c++/45246] optimizer dereference

2010-08-10 Thread paolo dot carlini at oracle dot com
--- Comment #1 from paolo dot carlini at oracle dot com 2010-08-10 08:17 --- What happens if you add -Wall to the command line? Current mainline tells me: u.cc: In function ‘void* foo(void*)’: u.cc:12:31: warning: dereferencing type-punned pointer will break strict-aliasing rules u.cc: