Bug or programmer error?

It’s possible that nvfortran is creating temporary arrays and running out of stack space for the larger values of n.

On a Linux machine you can try setting

ulimit -s unlimited

or increase the OpenMP stack size per thread (assuming that’s what do concurrent uses):

export OMP_STACKSIZE=512M

You can also remove the option -Mstack_arrays (if it was already set).