[Gambas-user] Issue 242 in gambas: Gamba forms fail on Debian ARM
gambas at ...2524...
gambas at ...2524...
Wed Apr 25 21:44:13 CEST 2012
Comment #5 on issue 242 by tvijlbr... at ...626...: Gamba forms fail on Debian
ARM
http://code.google.com/p/gambas/issues/detail?id=242
Eureka:
user at ...2825...:/media/data/user/gamba/gambas3-3.1.1$ gcc testpow.c
user at ...2825...:/media/data/user/gamba/gambas3-3.1.1$ ./a.out
8
segmentation fault
user at ...2825...:/media/data/user/gamba/gambas3-3.1.1$ cat testpow.c
#include <math.h>
#include <stdio.h>
long double powl(long double x, long double y)
{
return pow(x, y);
}
int main()
{
long double i= -5;
printf("%d\n", sizeof(i));
for (; i<=5; i++)
printf("%g\n", (double)10*pow(10,i));
}
====
So defining a version of powl causes the segfault!
What happens under the hood is that the symbol powl is replaced by pow
by the compiler. So the powl(long double,long double) is mapped to
pow(double,double). Your powl() definition turns into
double pow(double x, double y)
{
return pow(x, y);
}
A recursive funtion which eats up the stack until it segfaults.
I'm now recompiling with a patched config.h:
/* Define if you have modfl function. */
/* #undef HAVE_MODFL */
#define HAVE_MODFL 1
/* Define if you have powl function. */
/* #undef HAVE_POWL */
#define HAVE_POWL 1
I'm not sure about the (best) fix. Suggestions?
More information about the User
mailing list