This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libgcj/21115] false boolean argument passed from pre-compiled to interpreted method is true
- From: "green at redhat dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 20 Apr 2005 05:06:45 -0000
- Subject: [Bug libgcj/21115] false boolean argument passed from pre-compiled to interpreted method is true
- References: <20050419223032.21115.mark@gcc.gnu.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From green at redhat dot com 2005-04-20 05:06 -------
I think I see the problem here. The call in Test.java...
t.test(false, "FALSE");
...gets compiled into:
mov %eax,0x8(%esp) ;
movb $0x0,0x4(%esp) ; false boolean value
mov %edx,(%esp) ;
call *%ecx
Notice that we're only storing a byte into the word here at 0x4(%esp).
The "raw" libffi interface assumes that the call stack from the native code is
exactly what we'd see on the bytecode stack. This obviously isn't the case,
since, IIRC, booleans are represented as full words on the stack. And, indeed,
when we get the value of the boolean argument we're doing a LOADI from memory
copied from the 0x4(%esp). Three quarters of that word are complete garbage, so
the value of our LOADI is unknown (and, for those of us seeing failures, non-zero).
Possible fixes include:
- promoting booleans to words for function calls
- "fixing up" boolean args for raw calls
- don't use the raw call mechanis
I like the first option, but will it cause problems with CNI code?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21115