[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug classpath/28570] New: JNI on ARM: float parameters are not correctl
From: |
dheureuse at netlab dot nec dot de |
Subject: |
[Bug classpath/28570] New: JNI on ARM: float parameters are not correctly passed to java methods |
Date: |
2 Aug 2006 11:42:17 -0000 |
This bug might be similar to #22800.
This problem occurs on ARM platform (a Nokia 770; Scratchbox 0.9.8 was used for
crosscompilation). It does not occur on a x86 platform.
When a float parameter is passed to a Java method from within native code,
allways "0" is passed to Java instead of the correct float value.
When double is used instead of float, the problem does not occur.
This problem has been observed when using "CallStatic<...>Method(...)" and
"Call<...>Method(...)" calls.
The code below prints the following on a x86 platform (correct output):
Received 100.0
Received 1234.0
Returned 100.0
The output on an ARM platform is:
Received 0.0
Received 0.0
Returned 100.0
--- Code to reproduce the problem ---
----- JAVA -----
public class FloatTest {
public static void main(String[] args){
System.loadLibrary("floatTest");
float myFloat=100.0f;
float returned=nativeMethod( myFloat );
System.out.println("Returned "+returned);
}
private static void printFloat(float f){
System.out.println("Received "+f);
}
private static native float nativeMethod(float f);
}
------- native code -------
#include <jni.h>
#include "FloatTest.h"
JNIEXPORT jfloat JNICALL Java_FloatTest_nativeMethod(JNIEnv *env, jclass cls,
jfloat f){
env->CallStaticVoidMethod(cls, env->GetStaticMethodID(cls,
"printFloat", "(F)V"), f);
env->CallStaticVoidMethod(cls, env->GetStaticMethodID(cls,
"printFloat", "(F)V"), (float)1234.0);
return f;
}
--
Summary: JNI on ARM: float parameters are not correctly passed to
java methods
Product: classpath
Version: 0.91
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: classpath
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: dheureuse at netlab dot nec dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28570
- [Bug classpath/28570] New: JNI on ARM: float parameters are not correctly passed to java methods,
dheureuse at netlab dot nec dot de <=