C/C++ program Migration AIX to Linux

  aix, c++, qsort, segmentation-fault

Porting a C/C++ application from AIX to Linux it compiles and links into an executable. However when running I get a segmentation fault. Examination with gdb results in an error related to qsort. More precisely in the comparison function, when we cast the two void pointers into the structure they actually represent, it gives the error
Program received signal SIGSEGV, Segmentation fault.
0x0000000000422933 in qsort_det (
vd1=<error reading variable: Cannot access memory at address 0x7fffff4fdd48>,
vd2=<error reading variable: Cannot access memory at address 0x7fffff4fdd40>)
at scanTLog.cpp:8713
Even with an empty function this error occurs. It is really at the first line of the function. Any suggestion on what is going on here is greatly appreciated. The variable passed to qsort is an array of structures.

enter image description here

Source: Windows Questions C++

LEAVE A COMMENT