[Gambas-user] Issue 242 in gambas: Gamba forms fail on Debian ARM

gambas at ...2524... gambas at ...2524...
Wed Apr 25 21:20:23 CEST 2012


Comment #4 on issue 242 by tvijlbr... at ...626...: Gamba forms fail on Debian  
ARM
http://code.google.com/p/gambas/issues/detail?id=242

I'm getting somewhere, the call stack fails at an infinite call to pow():

(gdb) where^M
#0  *pow (x=10, y=-1) at gbx_math.c:250^M
#1  0x0002a504 in *pow (x=10, y=-1) at gbx_math.c:250^M
#2  0x0002a504 in *pow (x=10, y=-1) at gbx_math.c:250^M
#3  0x0002a504 in *pow (x=10, y=-1) at gbx_math.c:250^M
#4  0x0002a504 in *pow (x=10, y=-1) at gbx_math.c:250^M
#5  0x00036ad0 in read_float (option=<value optimized out>, ^M
     str=<value optimized out>, len=<value optimized out>, ^M
     value=<value optimized out>) at gbx_number.c:290^M
#6  NUMBER_from_string (option=<value optimized out>, ^M
     str=<value optimized out>, len=<value optimized out>, ^M
     value=<value optimized out>) at gbx_number.c:387^M
#7  0x0001dc58 in CLASS_load_without_init (class=<value optimized out>)^M
     at gbx_class_load.c:1047^M
#8  0x00032938 in load_exported_class (arch=<value optimized out>)^M
     at gbx_archive.c:138^M
#9  0x000438dc in COMPONENT_load (comp=0x6ba14) at gbx_component.c:266^M
#10 0x00043d38 in COMPONENT_load_all () at gbx_component.c:127^M
#11 0x00023cb0 in PROJECT_load () at gbx_project.c:465^M
#12 0x00035794 in init (file=0x50651 ".") at gbx.c:112^M
#13 0x00035e10 in main (argc=1, argv=<value optimized out>) at gbx.c:336^

Note that the debugger shows your own version of powl() (gbx_math.c:250)  
with long doubles although read_float calls pow() and not powl() !!!

Also config.h seems to lie about powl and modfl because when I change the  
definition
the compiler complains about redefinition, so they are probably gcc builtin.

Another issue is that on amd64 long floats are 16 bytes, on i386 they are  
12 bytes and on arm they are 8 bytes. Somehow the problem seams related to  
the usage of long double.

When I remove the definition of eg powl in your gbx_math.c than modules  
fail to load so I assume they are really used under the hood?

I'll test some more.

I did find a bug in gbx_math.c:

your definition of

#ifndef HAVE_MODFL
long double modfl(long double x, long double *iptr)
{
         double val;
         return modf((double)x, &val);
         *iptr = val;
}
#endif

You assign *iptr after the return!
I think it should be:

#ifndef HAVE_MODFL
long double modfl(long double x, long double *iptr)
{
         double val;
         double retval= modf((double)x, &val);
         *iptr = val;
         return retval;
}
#endif








More information about the User mailing list