So below is a while loop that works in debug but endlessly loops in release mode.
Ans FindMaxProj(PolyShape& S,Matrix<float,3,1>& N, Matrix<float,3,1>& cg, int StartInd){
MaxFound=false;
MaxIndInit=StartInd;
MaxValue=(cg+S.Verts.col(MaxIndInit)).transpose()*N;
while(!MaxFound){ //Infinitely loops in release mode, works in debug
MaxFound=true;
MaxInd=MaxIndInit;
for(int i=0; i<S.EdgeLinks[MaxInd].size();i++){
proj=(cg+S.Verts.col(S.EdgeLinks[MaxInd][i])).transpose()*N;
if(proj>MaxValue){
MaxFound=false; //Causes infinite looping in release mode
MaxValue=proj;
MaxIndInit=S.EdgeLinks[MaxInd][i];
}
}
MaxInd=MaxIndInit;
}
MaxCall.Value=MaxValue;
MaxCall.Ind=MaxInd;
return MaxCall;
}
I know it endlessly loops because if I add an iteration cap for the release mode, the loop will successfully end. S.EdgeLinks is a vector of int vectors. I am using Eigen for matrix math. Also, the passed in S is an extern variable. Also I am using CodeBlocks with default compiler settings. Please let me know if I should give more info.