TotalView Fortran Serial Exercise 3 - Solution

A solution

The index used to assign values to VECB goes out of the bounds for this array. The index only goes slightly outside the boundaries of the array, so it does not cause a segmentation fault. Instead, the loop starts assiging values to VECA2. Values in VECA2 were overwritten because VECA2 was in the next chunk of memory following VECB.

Change the index for VECB or comment out the line entirely to solve the problem.