This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libgcj/11951] New: natMethod.cc (_Jv_CallAnyMethodA) should clear ffi_result before ffi_call
- From: "mark at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 16 Aug 2003 21:02:53 -0000
- Subject: [Bug libgcj/11951] New: natMethod.cc (_Jv_CallAnyMethodA) should clear ffi_result before ffi_call
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11951
Summary: natMethod.cc (_Jv_CallAnyMethodA) should clear
ffi_result before ffi_call
Product: gcc
Version: 3.4
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: libgcj
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: mark at gcc dot gnu dot org
CC: gcc-bugs at gcc dot gnu dot org
This came up while debugging gjdoc with libxmlj (a JNI wrapper around libxml).
Don't have time now to create a test and a real patch.
diff -u -r1.32 natMethod.cc
--- java/lang/reflect/natMethod.cc 21 Jul 2003 01:54:06 -0000 1.32
+++ java/lang/reflect/natMethod.cc 16 Aug 2003 20:59:15 -0000
@@ -427,6 +427,10 @@
jdouble d;
} ffi_result;
+ // Result should be cleared since ffi_call might throw an exception.
+ // Then the result might still be used in JNI anyway.
+ ffi_result.o = NULL;
+
try
{
ffi_call (&cif, (void (*)()) meth->ncode, &ffi_result, values);