Just guessing: Putting something inside of parenthesis may be seen by the compiler as a whole condition. In your case you have created two independent conditions separated by “>”. Proper syntax using parenthesis (although not needed) would be …
IF (arrStruct[aiIndexArray[j]].R_index_courant > arrStruct[aiIndexArray[j+1]].R_index_courant) THEN
NRJ_ABC is a REAL right ? if you divide a INT by a REAL, you will have an automatic conversion from the INT to REAL without any WARNING as long as the output is also a REAL.
Any conversion from a type to a bigger type will be without warning:
USINT → UINT → UDINT → ULINT
SINT → INT → DINT → LINT
BYTE → WORD → DWORD → LWORD
REAL → LREAL
Also conversion from USINT→BYTE since those 2 contain the same data.
there is maybe more than that but i can’t remember it …