On Apr 13, 2006, at 5:48 PM, Tom Tromey wrote:

"Casey" == Casey Marshall <[EMAIL PROTECTED]> writes:

Casey> This isn't really related, but compiling this code with GCC 4.0.1 on
Casey> Darwin/x86 introduces a potentially serious problem. In the
Casey> `localBind' JNI function, I am doing this:

Casey> So, my question is, is this a known problem with GCC? If so, is there
Casey> any way to work around it?

Whenever I see a cast these days, I think that there must be an
aliasing bug.  But if there's one in this code, I don't see it.
Offhand I don't recall hearing of a bug like this.


The cast got me thinking, because GetStringUTFChars returns `const char *', and I'm trying to keep the code -Werror clean, so I cast it to `char *'. Changing everything to `const char *' in both the JNI function and the `local_bind' function does nothing, though.

My workaround so far is to add this to `local_bind':

> static int foo = 0;
> ...
>   if (foo)
>     fprintf (stderr, "bind %p\n", addr);

Reply via email to