Passing array size as argument for another array inside the task/function

In reply to cgales:

In reply to gabi0307:
Section 7.4.2 in the LRM states that dimensions for an unpacked array are required to be constant expressions. Using a variable violates this requirement.
You can use a dynamic array instead:


parameter SIZE_1 = 27;
task task1(input int SIZE, input logic my_array1, input logic my_array2);
automatic logic my_array3[] = new[SIZE-1];
//rest of the code
endtask
task1(SIZE_1, array1, array2);

the issue is I then need to compare mismatches of 2 arrays and if I define it as dynamic I am comparing between 2 different types of arrays. does it also solve that said issue?
i.e


logic my_array1[27];
//the definition you suggested
for(int i; i < 27; i++) begin
   if (my_array1[i] != my_array3[i])
      //do logic
end 

and I received that I am trying to compare between packed and unpacked array