Subject: Re: Problem with libgtop2
To: None <tech-userlevel@netbsd.org>
From: Martin J. Laubach <mjl+usenet-2004-02@emsi.priv.at>
List: tech-userlevel
Date: 04/12/2004 15:38:21
|  void foo(void *ptr)
|  {
|      int64_t *params = (int64_t *)ptr;
|      printf("arg1: %d\n", params[0]);
|      printf("arg2: %d\n", params[1]);
|  }
| 
|  void func(int64_t a, int64_t b)
|  {
|      foo((void *)&a); /* This is what libgtop does */

  This is plain and simple broken, the code assumes it knows how
the compiler passes arguments to functions. The compiler is free
to do what it wants, and this will fail spectacularly on arches
passing parameters in registers (like ppc).

	mjl