For loop inside fork join_none

In reply to dave_59:

Hi Dave,

Sorry for digging up a old post.

I tried running the modified code where the declaration of J is moved from the fork…join_none to the scope of for loop. But the processes spawned by the fork…join_none seems to get the final iteration’s value only.

module tb;
    initial begin
     for( int i =0; i<3 ; i++) begin
      automatic int k =i;
      fork begin
        $write ("%d ", i);
      end
      join_none
     end
    end
endmodule

the above code in EDA playground run using VCS prints 3 3 3. If the join_none is changed to join the output is 0 1 2.