cpp: #include <stdio.h>\n#include <stdlib.h>\nint main(int argc, char* argv[])\n{\n  int i,j;\n  float temp, sum=0.0;\n  int len=100;\n  if (argc>1)\n    len = atoi(argv[1]);\n  float u[len][len];\n  for (i = 0; i < len; i++)\n    for (j = 0; j < len; j++)\n        u[i][j] = 0.5;\n\n#pragma omp parallel for private (temp,i,j)\n  for (i = 0; i < len; i++)\n    for (j = 0; j < len; j++)\n    {\n      temp = u[i][j];\n      sum = sum + temp * temp;\n    }\n  printf ("sum = %f\n", sum); \n  return 0;\n}\n
fortran: program DRB022_reductionmissing_var_yes\n    use omp_lib\n    implicit none\n\n    integer :: i, j, len, argCount, allocStatus, rdErr, ix\n    real :: temp, getSum\n    character(len=80), dimension(:), allocatable :: args\n    real, dimension (:,:), allocatable :: u\n\n    len = 100\n    getSum = 0.0\n\n    argCount = command_argument_count()\n    if (argCount == 0) then\n        write (*,'(a)') "No command line arguments provided."\n    end if\n\n    allocate(args(argCount), stat=allocStatus)\n    if (allocStatus > 0) then\n        write (*,'(a)') "Allocation error, program terminated."\n        stop\n    end if\n\n    do ix = 1, argCount\n        call get_command_argument(ix,args(ix))\n    end do\n\n    if (argCount >= 1) then\n        read (args(1), '(i10)', iostat=rdErr) len\n        if (rdErr /= 0 ) then\n            write (*,'(a)') "Error, invalid integer value."\n        end if\n    end if\n\n    allocate (u(len, len))\n\n    do i = 1, len\n        do j = 1, len\n            u(i,j) = 0.5\n        end do\n    end do\n\n    !$omp parallel do private(temp, i, j)\n    do i = 1, len\n        do j = 1, len\n            temp = u(i,j)\n            getSum = getSum + temp * temp\n        end do\n    end do\n    !$omp end parallel do\n\n    print*,"sum =", getSum\n\n\n    deallocate(args,u)\nend program