signal 11 due to __c_mcopy8

Hi,

The following error occurs and cannot be resolved. Please help.

system: Linux 2.6.18-92.1.13.el5 #1 SMP, GNU
compilers: pgi 8-06
mpich
network: infiniband

terminated with signal 11 at PC=100f25a SP=7fffb2eaf7d8. Backtrace:
…/bin/nhm_driver(__c_mcopy8+0x17a)[0x100f25a]

Only one source file in c and this file was complied explicitly with pgcc. mcopy cannot be located in any source file. libpgcc.so is linked automatically shown by ‘ldd nhm_driver’. How to prevent libpgcc.so from being linked for a test?

Hi pliu,

libpgc.so contains all the C runtime library function so is required. However, I highly doubt that c_mcopy is to blame for the seg fault. It’s more likely that your program is trying to copy a null pointer or is coping past the end of an array. I would suggest compiling your code with “-g” and use the PGI debugger (pgdbg) to determine the exact cause of the seg fault.

Hope this helps,
Mat

Hi Mat,

Thanks. The only c source code caused the problem by a returned 32-bit pointer. Part of that source reads

void cnvedn_( int data_struct[2] )
{
void *p;
for(i=0;;i++){
if(data_struct_[0]==0){
break;
}
p=(void *)malloc(data_struct[0]*data_struct[1]); //line A
}
}

line A produces a compiling warning using pgcc -c as

Pointer value created from a nonlong integral type

but the warning does not show up with gcc. My temporary solution is to use gcc and the application works well.

How to change the code so that the int pointer can be 64-bit (long)? I am not so familiar with C, particularly the pointer._

Hi pliu,

You need to include the malloc.h header file so that malloc is defined. For example:

% cat test.c
#include <malloc.h>
void cnvedn_( int data_struct[][2] )
{
   void *p;
   int i;
   for(i=0;;i++){
      if(data_struct[i][0]==0){
         break;
      }
      p=(void *)malloc(data_struct[i][0]*data_struct[i][1]); //line A
   }
}
% pgcc -c test.c
%

Note that gcc will also give a warning if you’re missing malloc.h (unless you have -w set)

% gcc -c test.c
test.c: In function ‘cnvedn_’:
test.c:9: warning: incompatible implicit declaration of built-in function ‘malloc’

Hope this helps,
Mat

Hi Mat,

Yes, your solution helps to remove the warning.

I have to apologize because the actual cause is not what we have discussed. The final solution is not to use mpif90/mpicc but to use pgf90/pgcc/gcc to compile. The mpif90 and mpicc are used only to link the objects. This solution is very likely applicable to the system that I am using.

With that solution, the original codes still work!

Anyway, thank you for your great comments.