Error assembling a matrix 3d surface mesh

Hello,
I came across a segmentation fault when trying to get a matrix from varf when using a 3d surface mesh. The following code gives the error, using the torus given as example in the doc. I have tried with both FreeFem++4.5 and the recent 4.6.
Any ideas on how to solve this ?
Thank you.

load"msh3"                                                                                                                                                                               
real R = 3, r=1;                                                                                                                                                                         
real h = 0.2; //                                                                                                                                                                         
int nx = R*2*pi/h;                                                                                                                                                                       
int ny = r*2*pi/h;                                                                                                                                                                       
func torex= (R+r*cos(y*pi*2))*cos(x*pi*2);                                                                                                                                               
func torey= (R+r*cos(y*pi*2))*sin(x*pi*2);                                                                                                                                               
func torez= r*sin(y*pi*2);                                                                                                                                                               
meshS ThS=square3(nx,ny,[torex,torey,torez],orientation=-1) ;                                                                                                                            
                                                                                                                                                      
fespace Vh(ThS,[P1,P1]);                                                                                                                                                                 
                                                                                                                                                                                     
macro grad(u) [dx(u),dy(u),dz(u)] //EOM                                                                                                                                                  
                                                                                                                                                                                     
func f1 = 10;                                                                                                                                                                            
func f2 = -15;                                                                                                                                                                           
                                                                                                                                                                                     
varf vP([u1,u2],[v1,v2]) = int2d(ThS)(grad(u1)'*grad(v1)+ grad(u2)'*grad(v2)) - int2d(ThS)(f1*v1+f2*v2);                                                                                 
                                                                                                                                                                                     
matrix A = vP(Vh,Vh);
varf vP([u1,u2],[v1,v2]) = int2d(ThS)(grad(u1)'*grad(v1)+ grad(u2)'*grad(v2)) - int2d(ThS)(f1*v1+f2*v2);

I corrected the code, thank you.

Hi,
Does someone have an explanation for this?
Thank you,
Rémi

What is the problem right now?

The problem is:

matrix A = vP(Vh,Vh);

provokes a Segmentation fault (core dumped).

Not with the correct variational formulation, does it?

No, even with the correct formulation (I corrected it in the initial post) the error still arises.
Any other clue?

Hello,
I amn’t able to reproduce your bug,
can you give me information about your system please
Do you use binary package or compile FreeFEM?

Same for me: I can reproduce the segmentation fault with your initial code, but not with the new one.

Thank you for your help.

I have compiled Freefem++ 4.5 on Ubuntu 18.04.

Could you please try version 4.6?

Alright, it works with the 4.6 installed from the binary package. Thank you very much.