Problem with ARM port and pow() function

Fau Marz
Mon Oct 29 18:19:00 GMT 2007

Alle 19:08, martedì 23 ottobre 2007, Fau Marz ha scritto:

> Now I'm going to recompile newlib with -O0 option, and I want also to try 
> adding in makefiles CFLAGS_TO_TARGET the --mcpu=arm7tdmi-s -gdwarf-2 
> options. 

I've tried that, too.
No results: the same math functions continue to crash.

Now I can follow the code step-by-step with insight; I've examined the 
tan(22.2) function: the execution is regular up to the __ieee754_rem_pio2 
call inside the tan function. The __ieee754_rem_pio2 function itself is 
regular too, up to when it calls the fabs() function at line 128; fabs() 
seems to be executed regularly, but at the return point it doesn't return 
back to __ieee754_rem_pio2: instead it go to the starting point of the 
floor() function (with no apparently good reasons...).
At this point the execution start to be "not regular": the program flow does 
not follow the "if... else" flow, but it executes every line.
Following every line up to the end of floor(), it flows to another uncalled 
function scalbn(), then copysign(), then _fpadd_parts() and here at line 675 
(a simple sum) the program crashes with a data abort.

The fabs() function, where the problems seems to start, simply has two lines:

double fabs(double x)
	__uint32_t high;
        return x;

Could it be a problem with the endianness of the union structs used by these 
macros? (GET_HIGH_WORD and SET_HIGH_WORD use union structs defined in 

Anyone has an idea?




More information about the Newlib mailing list