Segmentation fault on integer assignment

Hi,

I get a run-time segmentation fault on an integer assignment statement (np=some_integer, or even np=1) in a fortran 77 subroutine. I compiled the code using:

pgf90 -Mbounds -Mpreprocess -g -O0

The code is made of Fortran 77 and Fortran 90 subroutines/modules. This subroutine works perfectly fine when used in another plain Fortran 77 code compiled with pgf90.

Does anyone know how to identify the problem?

Thanks,

Christophe

Hi Christophe,

You’ll want to use the PGI debugger, PGDBG, to walk through your code as it executes paying attention to the value “np”.

What data type is “np”? Do you have sample code which illustrates the problem?

Thanks,
Mat

Hi,

I get a SIGSEGV when the code executes np=92. np is an integer in a common block. np is unassigned before the line np=92, therefore its value is -1869573949 when I print it in pgdbg.

Christophe

Hi Christophe,

My best guess is that something is stomping over np’s memory reference but without more information I can’t be sure. Although -Mbounds isn’t finding it, are you writing beyond the end our an array in your common block?

  • Mat

Hi,

I assume the -Mbounds flag should not allow writings out of array bounds. I have more than one common block. I increased the size of the arrays in the common block where the variable np is by a factor 7 (so that they are 7 times bigger than needed), but the problem still occurs.

Christophe

Hi Christophe,

Yes, -Mbounds is supposed to check if the array goes out of bound. Which PGI compiler version do you use? Is it possible to provide us a test case? You can post it here or send to trs@pgroup.com.

Thank you,
Hongyon