This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Huge stack growth on using pow function

On using pow function defined in math.h, stack grows at 1904 bytes. Am i making some mistake in corrext execution or stack grows at such huge size on using pow function. Below is my code also

I am using LPC1317 with MDK V4.72.

#include "LPC13Uxx.h" /* LPC13xx definitions */
#include "math.h"

float32_t x,y,z;

int main(void)
{
    x = 2.3;
    y = 1.5;

    z = pow(x,y);
    if(z)
    {

    }

    while(1);
}

Parents Reply Children
  • I thought this might be bug in v4.70, so update keil to v4.72. Here stack doesn't grow to such value, stack only grows to 128 bytes.

    In both versions pow function give correct results, but there is huge stack difference b/w two.

    I found some other bug in v4.72, on option "clean target", keil doesn't clear all intermediate files.
    Second on changing from one opt level to another, opt settings didn't take effect on build only. You should rebuild the entire project. I think build option should also take opt setting when opt changes so that build also make all files again. (this was problem in v4.70 also)

  • But there is nothing implying it is a bug that the amount of memory differs - the size of information linked into the application will depend on how the library is structured. Maybe the newer library has been slightly rewritten, allowing the linker to be more selective in what to drag in.

    Take 10 PC compilers and use to build a "Hello World!" application. Compare the huge difference in size of that trivial application. What you see isn't bugs in the compilers but differences in the design of startup files and C runtime libraries.