Skip to content

rmaga points outside rzl_array for lasym with ntor = 0 #9

Description

@CharlesCNorton
! eqfor.f90:72-75
  IF (lasym) THEN
    rmaga => rzl_array(1,:,0,rcs)
    zmaga => rzl_array(1,:,0,zcc+ntmax)
  END IF

For LASYM = T with NTOR = 0, read_indata.f90:123-124 sets ntmax = 2, rsc = 2, zcc = 2 and leaves rcs at the 0 from read_indata.f90:105, since the cos(mu)sin(nv) basis does not exist without toroidal modes. The pointer then targets type index 0 of a dimension declared 1:3*ntmax.

Built with -fcheck=all, input.up_down_asymmetric_tokamak (VMEC++ test data; any lasym input with ntor = 0 does the same) stops at eqfor.f90:73:

Fortran runtime error: Index '0' of dimension 4 of array 'rzl_array' outside of expected range (1:6)

A release build reads the memory before the array. The value reaches eqfor.f90:751 (rax_asym(n) = -tz*rmaga(n1)) and the threed1 axis table at eqfor.f90:759, where the n = 0 factor tz = 0 hides it, so the table prints -0.0000E+00. The 2017 VMEC2000 8.52 source (eqfor.f:82) and PARVMEC carry the same association; associating rmaga only when rcs > 0 and using zero otherwise covers the ntor = 0 case.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions