🎉 Celebrating 25 Years of GameDev.net! 🎉
Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!
TestReturn failed
Hi,
I downloaded and compiled AngelScript 1.10.1b with Dev-Cpp 4.9.9.1 (MinGW 3.3.1). test_build_performance worked fine, but test_feature returned:
TestReturn (float): cfunction didn't return properly. Expected 18.870001, got 0.000000
I don't know is it related, but I had few warnings. Is this version compatible with MinGW?
Thanks for help.
<MY_WARNINGS>
g++.exe -c ../../source/test_constructor.cpp -o obj/test_constructor.o -I"E:/Dev-Cpp/include/c++/3.3.1" -I"E:/Dev-Cpp/include/c++/3.3.1/mingw32" -I"E:/Dev-Cpp/include/c++/3.3.1/backward" -I"E:/Dev-Cpp/lib/gcc-lib/mingw32/3.3.1/include" -I"E:/Dev-Cpp/include" -I"E:/Dev-Cpp/Common/Include" -I"../../../angelscript/include" -fsave-memoized -fexpensive-optimizations -O2
../../source/test_constructor.cpp: In function `bool TestConstructor()':
../../source/test_constructor.cpp:66: warning: invalid access to non-static
data member `CTestConstructor::a' of NULL object
../../source/test_constructor.cpp:66: warning: (perhaps the `offsetof' macro
was used incorrectly)
../../source/test_constructor.cpp:67: warning: invalid access to non-static
data member `CTestConstructor::b' of NULL object
../../source/test_constructor.cpp:67: warning: (perhaps the `offsetof' macro
was used incorrectly)
g++.exe -c ../../source/test_vector3.cpp -o obj/test_vector3.o -I"E:/Dev-Cpp/include/c++/3.3.1" -I"E:/Dev-Cpp/include/c++/3.3.1/mingw32" -I"E:/Dev-Cpp/include/c++/3.3.1/backward" -I"E:/Dev-Cpp/lib/gcc-lib/mingw32/3.3.1/include" -I"E:/Dev-Cpp/include" -I"E:/Dev-Cpp/Common/Include" -I"../../../angelscript/include" -fsave-memoized -fexpensive-optimizations -O2
../../source/test_vector3.cpp: In function `bool TestVector3()':
../../source/test_vector3.cpp:34: warning: invalid access to non-static data
member `Vector3::x' of NULL object
../../source/test_vector3.cpp:34: warning: (perhaps the `offsetof' macro was
used incorrectly)
../../source/test_vector3.cpp:35: warning: invalid access to non-static data
member `Vector3::y' of NULL object
../../source/test_vector3.cpp:35: warning: (perhaps the `offsetof' macro was
used incorrectly)
../../source/test_vector3.cpp:36: warning: invalid access to non-static data
member `Vector3::z' of NULL object
../../source/test_vector3.cpp:36: warning: (perhaps the `offsetof' macro was
used incorrectly)
g++.exe -c testvirtualinheritance.cpp -o obj/testvirtualinheritance.o -I"E:/Dev-Cpp/include/c++/3.3.1" -I"E:/Dev-Cpp/include/c++/3.3.1/mingw32" -I"E:/Dev-Cpp/include/c++/3.3.1/backward" -I"E:/Dev-Cpp/lib/gcc-lib/mingw32/3.3.1/include" -I"E:/Dev-Cpp/include" -I"E:/Dev-Cpp/Common/Include" -I"../../../angelscript/include" -fsave-memoized -fexpensive-optimizations -O2
../../source/testvirtualinheritance.cpp: In function `bool TestVirtualInheritance()':
../../source/testvirtualinheritance.cpp:69: warning: pointer to member cast via virtual base `CVBase1' of `CDerivedVirtual'
../../source/testvirtualinheritance.cpp:76: warning: pointer to member cast via virtual base `CVBase2' of `CDerivedVirtual'
</MY_WARNINGS>
I compile and test the library with MinGW with every release. Though I suspect that they changed something in the compiler with the latest release that make the return of floats and doubles fail in AngelScript. I've received a report of the same behaviour on Linux GNUC compiler.
I'll download the latest MinGW compiler and see if I can figure out what's going on.
The warnings you are receiving are unrelated to your problem. They are only warnings and the tests works as supposed.
I'll download the latest MinGW compiler and see if I can figure out what's going on.
The warnings you are receiving are unrelated to your problem. They are only warnings and the tests works as supposed.
I just downloaded Dev-C++ 4.9.9.1 and ran the test_feature with it. Everything worked just fine, including the TestReturnF test.
Maybe you set some configurations that I didn't. Could you send me the project files for AngelScript and test_feature that you used? Or maybe tell me what you changed from the default settings.
Maybe you set some configurations that I didn't. Could you send me the project files for AngelScript and test_feature that you used? Or maybe tell me what you changed from the default settings.
I managed to reproduce the problem. When I configured Dev-C++ to compile the library with optimizations the TestReturnF test failed.
So, until I can get this fixed I recommend that you turn off optimizations for the library.
So, until I can get this fixed I recommend that you turn off optimizations for the library.
I found and fixed the bug. You'll have to replace the implementation for GetReturnedFloat() and GetReturnedDouble() in as_callfunc_x86.cpp:
I'd like to credit you for reporting the bug. Would you mind telling me your real name?
asDWORD GetReturnedFloat(){ asDWORD f;#if defined ASM_INTEL // Get the float value from ST0 __asm fstp dword ptr [f]#elif defined ASM_AT_N_T asm("fstps %0 \n" : "=m" (f));#endif return f;}asQWORD GetReturnedDouble(){ asQWORD d;#if defined ASM_INTEL // Get the double value from ST0 __asm fstp qword ptr [d]#elif defined ASM_AT_N_T asm("fstpl %0 \n" : "=m" (d));#endif return d;}
I'd like to credit you for reporting the bug. Would you mind telling me your real name?
At first sorry for delay, but I didn't get mail notification about your replies.
Glad to help. After "patch" this test works ok. My real name is Marcin Zajaczkowski.
I have one more question. In test_multithread I had to change
After this I have
I don't know is it related with this include.
Regards
Marcin
Glad to help. After "patch" this test works ok. My real name is Marcin Zajaczkowski.
I have one more question. In test_multithread I had to change
#include "../../add_on/stdstr/stdstr.h"
to#include "../../add_on/std_string/stdstring.h"
in utils.h to compile. I'm not sure if stdstr.h and stdstring.h is the same, but I couldn't find it in tarball and "Utils & add-ons".After this I have
TestSharedString: Shared strings don't work as they should
I don't know is it related with this include.
Regards
Marcin
Thanks for replying Marcin.
The stdstr and the stdstring are the same source. I forgot to update the multithreaded test though, thanks for letting me know.
In order for the multithreaded test to work, the AS library has to be compiled with the preprocessor flag USE_THREADS defined. Description on this and other flags can be found in as_config.h.
Regards,
Andreas
The stdstr and the stdstring are the same source. I forgot to update the multithreaded test though, thanks for letting me know.
In order for the multithreaded test to work, the AS library has to be compiled with the preprocessor flag USE_THREADS defined. Description on this and other flags can be found in as_config.h.
Regards,
Andreas
USE_THREADS helps.
Has this option any side effect? Or it's disabled by default due to portability?
Thanks for help
Marcin
Has this option any side effect? Or it's disabled by default due to portability?
Thanks for help
Marcin
The main reason it is disabled by default is because the support for multithreading hasn't been fully tested.
There is a slight overhead when turning on multithreaded support because of need to use critical sections to protect the reference counting. But the actual execution of the script code shouldn't be affected.
The multithreaded support is also only available on Windows.
There is a slight overhead when turning on multithreaded support because of need to use critical sections to protect the reference counting. But the actual execution of the script code shouldn't be affected.
The multithreaded support is also only available on Windows.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement