On Aug 20, 2007, at 2:07 PM, mabshoff wrote:

>> However, there is one "error" which valgrind reports on my own code
>> from time to time which I have been unable to determine the source  
>> of.
>> It says something like "conditional jump depends on uninitialised
>> data". I have stared at code for hours trying to determine where  
>> these
>> errors come from. I still have code for which I have been unable to
>> eliminate such errors.
>>
>
> That usually happens in the following circumstance:
>
> int i; // this is initialized to zero on any sane system, i.e.
> anywhere but Windows :)

To make sure I know what's going on, this for "static" variables,  
i.e., those declared outside the scope of a procedure, or explicitly  
static within a procedure.

> if (i>0)
>    do something;

If the above sequence is literally what's in the file, then it is an  
uninitialized variable, right?

> Now valgrind assumes that "conditional jump depends on uninitialised
> data", i.e. "i". Well, but it is zero anyway would one say. And you
> would be correct in 99% of all cases, but I fixed a bug very similar
> to the above in LinBox about 4 weeks ago that caused a crash on Debian
> unstable's gcc but not with the other 10 compilers I tried. Lesson
> lerned. The assigment to zero puts i into another segment, so many
> people avoid it.

I don't understand your last comment: are you saying that using "int  
i = 0;" is something that most people avoid?  Why?  (I understand the  
'segment' part; this puts 'i' in a segment of initialized data;  
otherwise, it's up to the runtime to initialize a chunk of memory  
with zeros and 'i' is in that segment (which is not in the file, only  
created at runtime)).

A compiler that does anything else isn't a 'C' compiler :-}

Justin

--
Justin C. Walker, Curmudgeon at Large
Institute for the Absorption of Federal Funds
-----------
My wife 'n kids 'n dogs are gone,
I can't get Jesus on the phone,
But Ol' Milwaukee's Best is my best friend.
-----------



--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to