The range of the part select is illegal:

//Creating a binary tree, so at each level the ranges are known.
//I can’t comprehend why SV complains about illegal range of part select.
The range of the part select is illegal:
req_mux[LVL][NODE][(MAX_BKT_AT_LVL - 2):0]


   logic [SIZE:0][WIDTH-1:0][NUM_SEL-1:0][WIDTH-1:0] 	  req_mux;

   int MAX_BKT_AT_LVL,MAX_BKT_LOWER_LVL,NODE,LVL;
   
   //Initialize leaf's of tree to data_in
   always_comb begin
      req_mux     = '0; 

      for(int i=0;i<WIDTH;i++) begin
        req_mux    [SIZE][i][0][WIDTH-1:0] = req_in [i];
      end
 
      for(LVL=SIZE-1; LVL>=0; LVL--) begin
         for(NODE=0; NODE < 1 << LVL; NODE++) begin
	    MAX_BKT_LOWER_LVL = ((1 << SIZE-LVL-1) >  NUM_SEL) ? NUM_SEL : (1 << (SIZE-LVL-1));
	    MAX_BKT_AT_LVL    = ((1 << SIZE-LVL)   >  NUM_SEL) ? NUM_SEL : (1 << (SIZE-LVL));
	    //Default:Pull lower level up 
	    for(int bkt=0; bkt < MAX_BKT_LOWER_LVL; bkt++) begin:BKT_DEF
	       req_mux    [LVL][NODE][bkt] =  req_mux    [LVL+1][2*NODE + 1][bkt] << (1 << SIZE-LVL-1);
	    end
	    
	    //If the priority side has elements, pull those up while shifting the default elements.
	    for(int bkt=0; bkt < MAX_BKT_LOWER_LVL; bkt++) begin:BKT
	       if(sum[LVL+1][2*NODE+0][bkt]) begin
		  req_mux    [LVL][NODE] =  {req_mux    [LVL][NODE][MAX_BKT_AT_LVL-2:0],req_mux    [LVL+1][2*NODE + 0][bkt]};
	       end // block: BKT
	    end
	    //$display("LVL %d, NODE %d, Rem_Sel %b,MAX_BKT_LOWER_LVL %d ,MAX_BKT_AT_LVL %d",LVL,NODE,rem_sel,MAX_BKT_LOWER_LVL,MAX_BKT_AT_LVL);
	 end
      end
   end

In reply to msal:

Section 7.4.6 of the LRM tells you why:

The size of the part-select or slice shall be constant, but the position can be variable.

MAX_BKT_AT_LVL is a variable, hence the size of the part-select changes, which is illegal.

In reply to cgales:

At compile time, the SIZE is known and therefore at each level of the binary tree, MAX_BKT_AT_LVL is known.

I’ll define MAX_BKT_AT_LVL as int[SIZE][LVL] instead.
Thanks,