# C-STACK overflow during integration

I am trying to run the following chunk of code

```
i = a*(1 + exp(-(b*x)^2/4)*cos(c*x)*cos(d*x))
i0 = i.subs(x=0)
W = 2*i - i0
G = integrate(W*exp(-I*k*x),(x,-oo,oo),algorithm="fricas").full_simplify()
```

with a,b,c,d,k,x being variables. When I do, I get the error

```
TypeError: ECL says: C-STACK overflow at size 1048576. Stack can probably be resized. Proceed with caution
```

The interesting thing is that when I have

```
i = a*(1 + exp(-b*x^2/4)*cos(c*x)*cos(d*x))
```

and everything else the same, the integral can be performed. I was wondering either how to resize the stack as the error message suggests or how to fix the overflow?

Thank you for your time

As a side note: the error is one that can come from "maximalib", so it doesn't seem like your option

`algorithm="fricas"`

is working. The C-stack overflow is probably an infinite recursion that probably happens in maxima itself as well (if the options are set in the same way as sage does). That would be reportable to maxima.