[#3419] Valgrind analysis of [BUG] unknown node type 0 — Andrew Walrond <andrew@...>

Hello list,

19 messages 2004/09/17
[#3422] Re: Valgrind analysis of [BUG] unknown node type 0 — ts <decoux@...> 2004/09/17

>>>>> "A" == Andrew Walrond <andrew@walrond.org> writes:

[#3423] Re: Valgrind analysis of [BUG] unknown node type 0 — Andrew Walrond <andrew@...> 2004/09/17

On Friday 17 Sep 2004 12:01, ts wrote:

[#3424] Re: Valgrind analysis of [BUG] unknown node type 0 — ts <decoux@...> 2004/09/17

>>>>> "A" == Andrew Walrond <andrew@walrond.org> writes:

[#3425] Re: Valgrind analysis of [BUG] unknown node type 0 — Andrew Walrond <andrew@...> 2004/09/17

On Friday 17 Sep 2004 12:37, ts wrote:

[#3426] Re: Valgrind analysis of [BUG] unknown node type 0 — ts <decoux@...> 2004/09/17

>>>>> "A" == Andrew Walrond <andrew@walrond.org> writes:

[#3428] Re: Valgrind analysis of [BUG] unknown node type 0 — Andrew Walrond <andrew@...> 2004/09/17

On Friday 17 Sep 2004 13:05, ts wrote:

[#3429] Re: Valgrind analysis of [BUG] unknown node type 0 — ts <decoux@...> 2004/09/17

>>>>> "A" == Andrew Walrond <andrew@walrond.org> writes:

Re: Valgrind analysis of [BUG] unknown node type 0

From: Robert McGovern <robert.mcgovern@...>
Date: 2004-09-17 10:56:31 UTC
List: ruby-core #3421
> The global static variables lomem and himem in gc.c do not seem to be
> initialised before use:
> 
> $ grep -E \(lo\|hi\)mem gc.c
> static RVALUE *himem, *lomem;
>     if (lomem == 0 || lomem > p) lomem = p;
>     if (himem < pend) himem = pend;
>     if (p < lomem || p > himem) return Qfalse;
> 
> I assume the fix would be
> static RVALUE *himem=0, *lomem=0;

My understanding is that Statics are automatically initialized to 0
thought its recommended to do it explicitly. I don't have a copy of
the C Standard around to verify this though.

Found something here[1] and here [2]

Rob

[1] http://64.233.161.104/search?q=cache:j7lcXTGCmJkJ:www-ee.eng.hawaii.edu/Courses/EE150/Book/chap14/subsection2.1.1.6.html+C+static+variables&hl=en

"While the static variable,  sum, would be automatically initialized
to zero, it is better to do so explicitly."

[2] http://216.239.41.104/search?q=cache:VTTfL5D7IMYJ:publications.gbdirect.co.uk/c_book/chapter6/initialization.html+C+static+variable+initialization&hl=en

"Unless they have an explicit initializer, all objects with static 
duration are given implicit initializers—the effect is as if the
constant 0 had been assigned to their components. This is in fact
widely used—it is an assumption made by most C programs that external
objects and internal static objects start with the value zero."
-- 
Personal responsibility is battling extinction.


In This Thread