Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » Draw, Display, Images, Bitmaps, Icons » Conditional jump or move depends on uninitialised value(s)
icon13.gif  Conditional jump or move depends on uninitialised value(s) [message #19830] Mon, 26 January 2009 02:35 Go to next message
Novo is currently offline  Novo
Messages: 1358
Registered: December 2006
Ultimate Contributor
Linux x86_64 Ubuntu 7.10
Application: HomeBudget

Conditional jump or move depends on uninitialised value(s)

/home/ssg/dvlp/cpp/upp/svn/uppsrc/Draw/Draw.cpp:100 (if(tonative) {)
/home/ssg/dvlp/cpp/upp/svn/uppsrc/Draw/Draw.cpp:127 (if(tonative))



Regards,
Novo

[Updated on: Mon, 26 January 2009 05:20]

Report message to a moderator

Re: Conditional jump or move depends on uninitialised value(s) [message #19836 is a reply to message #19830] Mon, 26 January 2009 10:04 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Novo wrote on Sun, 25 January 2009 20:35

Linux x86_64 Ubuntu 7.10
Application: HomeBudget

Conditional jump or move depends on uninitialised value(s)

/home/ssg/dvlp/cpp/upp/svn/uppsrc/Draw/Draw.cpp:100 (if(tonative) {)
/home/ssg/dvlp/cpp/upp/svn/uppsrc/Draw/Draw.cpp:127 (if(tonative))




These are now definitely fixed.

Mirek
Re: Conditional jump or move depends on uninitialised value(s) [message #19842 is a reply to message #19836] Mon, 26 January 2009 16:10 Go to previous messageGo to next message
Novo is currently offline  Novo
Messages: 1358
Registered: December 2006
Ultimate Contributor
Thanks!

I have a lot of problems with x64 platforms. TheIDE is not working with Windows XP x64, my application crashes on x64 Linux.

Hopefully, it is fixed now.


Regards,
Novo
Re: Conditional jump or move depends on uninitialised value(s) [message #19843 is a reply to message #19842] Mon, 26 January 2009 17:29 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Interesting.

theide not working in win64, that is a new one... Going to check it soon - have not for a while.

OTOH, I am using Ubuntu64 for all Linux development, booting Ubuntu32 really rarely (about as often as Vista64) - have not noticed any problems at all.

What packages is your app using?

Mirek
Re: Conditional jump or move depends on uninitialised value(s) [message #19849 is a reply to message #19843] Tue, 27 January 2009 06:06 Go to previous messageGo to next message
Novo is currently offline  Novo
Messages: 1358
Registered: December 2006
Ultimate Contributor
Thanks. All reported uninitialised values are gone.


luzr wrote on Mon, 26 January 2009 11:29

Interesting.

theide not working in win64, that is a new one... Going to check it soon - have not for a while.



I got XP x64 in my current company and tried to build and use 64-bit version of TheIDE. I managed to build and launch it, but got no luck with putting brackpoints.

I'll try to check that again tomorrow.


Quote:


OTOH, I am using Ubuntu64 for all Linux development, booting Ubuntu32 really rarely (about as often as Vista64) - have not noticed any problems at all.

What packages is your app using?

Mirek


After fixing all issues with Draw and SQL the only problem I'm seeing is with GridCtrl. But this is another story.

Another useful fix. This is an uninitialized value too. Using of initialization lists is a good practice ... Wink

Index: uppsrc/Core/Gtypes.h
===================================================================
--- uppsrc/Core/Gtypes.h        (revision 812)
+++ uppsrc/Core/Gtypes.h        (working copy)
@@ -60,7 +60,7 @@
 
        String        ToString() const;
 
-       Size_() {}
+       Size_() : cx(0), cy(0) {}
        Size_(T cx, T cy) : cx(cx), cy(cy) {}
 
        Size_(const Size_<int>& sz)  : cx((T)sz.cx), cy((T)sz.cy) {}



Regards,
Novo

[Updated on: Tue, 27 January 2009 06:08]

Report message to a moderator

Re: Conditional jump or move depends on uninitialised value(s) [message #19852 is a reply to message #19849] Tue, 27 January 2009 10:25 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Novo wrote on Tue, 27 January 2009 00:06

Thanks. All reported uninitialised values are gone.


luzr wrote on Mon, 26 January 2009 11:29

Interesting.

theide not working in win64, that is a new one... Going to check it soon - have not for a while.



I got XP x64 in my current company and tried to build and use 64-bit version of TheIDE. I managed to build and launch it, but got no luck with putting brackpoints.



Ah, well. Debugger not working, that is expected, at least sort of. Some more work is needed there.

Index: uppsrc/Core/Gtypes.h
===================================================================
--- uppsrc/Core/Gtypes.h        (revision 812)
+++ uppsrc/Core/Gtypes.h        (working copy)
@@ -60,7 +60,7 @@
 
        String        ToString() const;
 
-       Size_() {}
+       Size_() : cx(0), cy(0) {}
        Size_(T cx, T cy) : cx(cx), cy(cy) {}
 
        Size_(const Size_<int>& sz)  : cx((T)sz.cx), cy((T)sz.cy) {}



Well, that is how it is meant to be. If you do not initialize Size, it is not initialized...

The point is

Buffer<Size> x(1000);

I might not want to have implicit memset(&x, 0, 4000) - what if I know I am going to change these sizes immediately to something else?

Mirek
Re: Conditional jump or move depends on uninitialised value(s) [message #19866 is a reply to message #19852] Wed, 28 January 2009 05:43 Go to previous messageGo to next message
Novo is currently offline  Novo
Messages: 1358
Registered: December 2006
Ultimate Contributor
luzr wrote on Tue, 27 January 2009 04:25


Well, that is how it is meant to be. If you do not initialize Size, it is not initialized...

The point is

Buffer<Size> x(1000);

I might not want to have implicit memset(&x, 0, 4000) - what if I know I am going to change these sizes immediately to something else?

Mirek



Objections:

1) it looks like you added documentation about that only today. Wink And the word "uninitialized" is not in capital letters, so, it is very easy to overlook that.

2) you are saving two assembler commands per object and causing a lot of problems for other developers. Does it really worth that? It looks like one needs to learn all these tricky side-effects before he can start developing.

There always be problems with Size because of that. Guess how I found this constructor. Wink At some point you will forget all these tricks yourself. Hopefully it happens after you turn 80. Wink


Regards,
Novo
Re: Conditional jump or move depends on uninitialised value(s) [message #19869 is a reply to message #19866] Wed, 28 January 2009 09:46 Go to previous messageGo to next message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
I personally don't think this is a major issue:
1) All Upp 'basic' types (those with public member variables, Point_, Rect_ etc) exibit the same behaviour, so you only have to learn it once.
2) C++ convention is that variables are uninitialised, so you should be aware of the issue already. Buffer<int> x(2000); would be just as uninitialised.

On the other hand, in probably 99.9% of cases initialisation would be safer and come without any practical performance consequences.

Perhaps there is a case for having initialisation on by default, but available to be switched off with a compiler flag for those who really care?

[Updated on: Wed, 28 January 2009 09:50]

Report message to a moderator

Re: Conditional jump or move depends on uninitialised value(s) [message #19873 is a reply to message #19869] Wed, 28 January 2009 16:21 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
mrjt wrote on Wed, 28 January 2009 03:46

I personally don't think this is a major issue:
1) All Upp 'basic' types (those with public member variables, Point_, Rect_ etc) exibit the same behaviour, so you only have to learn it once.
2) C++ convention is that variables are uninitialised, so you should be aware of the issue already. Buffer<int> x(2000); would be just as uninitialised.

On the other hand, in probably 99.9% of cases initialisation would be safer and come without any practical performance consequences.

Perhaps there is a case for having initialisation on by default, but available to be switched off with a compiler flag for those who really care?


I guess that pretty much sums what I think about the issue... Smile

Except I would not vote for the compiler flag and my wild estimate is more something like 95%....

Mirek
Re: Conditional jump or move depends on uninitialised value(s) [message #19876 is a reply to message #19873] Thu, 29 January 2009 02:56 Go to previous message
Novo is currently offline  Novo
Messages: 1358
Registered: December 2006
Ultimate Contributor
luzr wrote on Wed, 28 January 2009 10:21


I guess that pretty much sums what I think about the issue... Smile

Except I would not vote for the compiler flag and my wild estimate is more something like 95%....

Mirek



OK. Thanks for the explanation.


Regards,
Novo
Previous Topic: To split Images code to "h" & "cpp" file has a link error, "multiple de
Next Topic: DrawOpWin32.cpp, line 96 q != ERROR
Goto Forum:
  


Current Time: Fri Apr 19 11:32:25 CEST 2024

Total time taken to generate the page: 0.07210 seconds