(long) inconsistency in ld.so

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, 

(forgives me if this question is very newbie or off-topic ;)


i wrote a simple example of usage double linked list,
but when run this return this error.

Inconsistency detected by ld.so: dl-fini.c: 50: _dl_fini: Assertion
`_rtld_local._dl_nloaded > 0' failed!


exit of the program:
alessandro@phoenix:estruturasI$ cc d_linked_list.c -o d_linked_list -g
alessandro@phoenix:estruturasI$ ./d_linked_list
add=> 0
add=> 1
add=> 2
add=> 3
add=> 4
add=> 5
add=> 6
add=> 7
add=> 8
add=> 9
 9
 8
 7
 6
 5
 4
 3
 2
 1
Inconsistency detected by ld.so: dl-fini.c: 50: _dl_fini: Assertion
`_rtld_local._dl_nloaded > 0' failed!


source code...

#include <stdio.h>
#include <stdlib.h>

typedef struct _lista
{
    int             info;
    struct _lista  *prev;
    struct _lista  *next;
}              *lista;

lista           getnodo ();
void            add (lista * L, int p, int v);


int
main (void)
{
    lista           l;
    int             i;

    l->next = NULL;
    l->prev = NULL;
    for (i = 0; i < 10; i++)
	{
	    add (&l, 1, i);
	    printf ("\nadd=> %d", l->info);
	}

    while (l->prev)
	{
	    printf ("\n %d", l->info);
	    l = l->prev;
	}
    return 0;
}


/* 
 * p is position of insertion 
 * 1 is a after address of list
 * 0 is a before address of list
 */
void
add (lista * L, int p, int v)
{
    lista           a;

    a = getnodo ();
    a->info = v;
    if (((*L)->prev == NULL) && (p == 0))
	{
	    a->prev = NULL;
	    a->next = *L;
	    (*L)->prev = a;
	}
    else if (((*L)->next == NULL) && (p == 1))
	{
	    a->prev = *L;
	    a->next = NULL;
	    (*L)->next = a;
	}
    else if (((*L)->prev != NULL) && (p == 0))
	{
	    a->prev = (*L)->prev;
	    a->next = *L;
	    (*L)->prev = a;
	    *L = a->prev;
	    (*L)->next = a;
	}
    else if (((*L)->next != NULL) && (p == 1))
	{
	    a->next = (*L)->next;
	    a->prev = *L;
	    (*L)->next = a->next;
	    (*L)->prev = a;
	}
    *L = a;
}

lista
getnodo ()
{
    lista           plista;
    plista = (lista) malloc (sizeof (struct _lista));
    return (plista);
}


best regards!

-- 
 ,= ,-_-. =.  [<o>] Alessandro Madruga Correia     
((_/)o o(\_)) [http://counter.li.org]              Slack User# 342751
 `-'(. .)`-'  GNU/Linux SlackWare 10.0             Kernel 2.4.26
     \_/      "Nao existe patch pra estupidez humana."

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux