Do you have any suggestions for next step(s)?
the "memory access" error happens randomly, so I don't know how to check it. Does it due to GCC or GDB?
So far, on my system, it has been dependent on the location of the data file (but, apparently not for you?). I do not have the problem when the data file is in the project directory, but when it is located in (possibly specific) other folders. Since it is the same code (already compiled with a given compiler) that has the problem in one location, but not another, I'm leaning towards thinking it is the debugger.
So far, the pattern on my system (3 different project files) is this:
-data file in parallel folder (up a level from the project file, then down a level into another folder) - the problem always occurs.
-data file in project folder -it
usually works, although not always. But immediately running it again can change the result from the previous run
-data file in parent folder - fairly random