Comment #5 on issue 242 by [email protected]: Gamba forms fail on Debian
ARM
http://code.google.com/p/gambas/issues/detail?id=242
Eureka:
user@Nokia-N800-43-7:/media/data/user/gamba/gambas3-3.1.1$ gcc testpow.c
user@Nokia-N800-43-7:/media/data/user/gamba/gambas3-3.1.1$ ./a.out
8
segmentation fault
user@Nokia-N800-43-7:/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?
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Gambas-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gambas-user