set_child_at (node=0x7fffffffe080, child=0x61e250, index=1) at 10679.c:319
319		if ((*node)->count_children == (*node)->m)
(gdb) p *current_node
$3 = (trie_node *) 0x0
(gdb) n
324		index = hash_insert((*node)->hv, index, (*node)->m, (*node)->m1);
(gdb) n
325		(*node)->children[index] = child;
(gdb) p current_node
$4 = (trie_node **) 0x61e270
(gdb) p *current_node
$5 = (trie_node *) 0x0
(gdb) n
326		child->parent = *node;
(gdb) p *current_node
$6 = (trie_node *) 0x0
(gdb) n
327		child->pos_in_parent = index;
(gdb) p *current_node
$7 = (trie_node *) 0x61e450
(gdb) p child
$8 = (trie_node *) 0x61e250
(gdb) pt child->pos_in_parent 
type = int
(gdb) pt index
type = int
(gdb) p *child
$9 = {key_index = 0, is_leaf = 1, count_children = 0, branch_at = 0, children = 0x61e2a0, edge = 0x0, parent = 0x61e450, pos_in_parent = 0, id = 0, is_pruned = 0, freq = 0, 
  hv = 0x61e310, m = 13, m1 = 11}
(gdb) p node
$10 = (trie_node **) 0x7fffffffe080
(gdb) p *node
$11 = (trie_node *) 0x61e450
(gdb) p current_node
$12 = (trie_node **) 0x61e270

At line 18, a simple integer (line 25-26 shows it as int) is assigned to another simple integer (line 23-24 shows it). And bang there is some short circuit and some unrelated variable current_node is assigned some irrelevant value (line 19-20). It was NULL just 2 lines back (line 15-16). And all the pointers are distinct memory locations (line 29-35). current_node is not even a local variable passed as parameter (line 1). In fact defined as a global variable.

Recommended Answers

All 2 Replies

There is an old saying -- "garbage in, garbage out". What you posted is not even C code. I don't know what it is, but he certainly isn't C or C++ languages.

There is an old saying -- "garbage in, garbage out". What you posted is not even C code. I don't know what it is, but he certainly isn't C or C++ languages.

That would be the output of the GNU gdb (debugger)....And yes C does blow sometimes.

Maybe if you posted the code we could make sense of this.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.