I ran into a tiny bug: it is possible to run MFIX-25.1* with des_usr_var_size = 5 for instance, and in a subroutine use des_usr_var(6,LL) = … and it does not crash (I vaguely recall that it used to?). However, it does reset the usr_var value after the first time step (got me looking for that one for a while). Poor coding I know – but wonder if that is not worth a error flag stating that?
I think if you compile in debug mode, it should pick up the out of bound error during compilation or at least at run time. Once you start accessing arrays outside their declared range, you can overwrite data and it is difficult to track. Best practice when writing UDF is to compile and run in debug mode first, then if everything looks fine, you can switch to optimized mode. I don’t think we (the develop team) can put an error flag for this since it involves custom code, but you can either put an IF statement before you use slot 6 to make sure it is smaller or equal to des_usr_var_size.
You will get a segmentation fault if the array access is far enough out of bounds, but unfortunately exceeding the end of the array by 1 or 2 elements is not enough to cause a segfault. And runtime checks are expensive, which is why they are only enabled in debug mode.