program seg faults unless compiled with -g

I’ve been part of a Fortran95 code conversion for a large molecular dynamics program; the code compiles and completes test cases for both GCC/gfortran and Intel/ifort compilers. With PGI/pgf95 (including 10.3), code compiled without -g (at any optimization level) fails most of the test cases with segmentation violations, which seem to come from routine __hpf_bcopysl

Because the error does not occur when compiled with -g, it has been difficult to track down any further. Suggestions are appreciated, as we’d like to continue to support the PGI compiler with the program installation procedures.

For what it is worth, I have a similar problem, on a large body of code that I am converting from Intel to PGI. In my case, -gopt, with O0 and O1 seem fine, it is when I use -gopt and O2 that I get the segmentatiion fault.

Strategically placed write statements make the problem disappear, but that is not a practical solution.

Malcolm Bibby

this happened to me once also.

Hi BenjaminMiller66516,

“__hpf_bcopysl” is a runtime routine that performs strided bcopy. Most likely one or more of the arrays being copied is getting corrupted somehow.

Would it be possible for me to download the code and investigate the error?


Not directly, as there are some license issues and commercial entanglements. We can probably arrange access to the source, likely subject to a formal non-disclosure agreement. We have a PGI subscription; should we file a support request to facilitate this?

Hi BenjaminMiller66516,

Yes, please send a report to PGI Customer Service (

  • Mat

Mat, as I reported earlier in this thread, I have a similar problem. I would be happy if you would download a copy of the code and see what you can find.


I would be happy if you would download a copy of the code and see what you can find.

Sure. Please post or send the link to PGI Customer Service ( Also, please include directions on building and running the application and include any necessary data files.

  • Mat

Mat, thanks for the offer to take a look at my problem. I can give you access to my machine. To do this I would have to give you my IP, name, password, etc. I would like to do this verbally.



Hi Malcolm,

Trying to debug code remotely can be very difficult and time consuming. I’m happy to investigate the issue, but would need to have the source here.