Why would code compiled on an Intel CPU crash on an AMD CPU machine?

  amd-processor, boost, c++, intel, opencv

I have an application, developed in c++, in visual studio, on windows, with an Intel CPU.

This application is in use on multiple machines, at multiple locations, all with Intel CPUs.

Lately, it was installed on a PC with an AMD CPU.

On the AMD machine, on a certain function, the application freezes and crashes.

The function that crashes uses boost thread locking, and then standard opencv functionality (specifically the aruco fiducial marker module), so I assume that the issue is the thread locks.

the relevant code is:

//header

typedef boost::shared_mutex Lock;
typedef boost::unique_lock< Lock > WriteLock;
typedef boost::shared_lock< Lock > ReadLock;
Lock floorLock;

//thread one (Producer)

WriteLock f_lock2(floorLock);
frameFloor = image_ocv.clone(); //an opencv::Mat 
f_lock2.unlock();

//thread two (consumer)

cv::Mat image_ocv;
ReadLock f_lock2(floorLock);
image_ocv = frameFloor;
f_lock2.unlock();

I have tried swapping these out for thead-safe queues, and the crash persists.

Another third party has now tested this on different machines, and confirms the behaviour.
The only difference between machines where this runs fine, and machines where it crashes, is the Intel vs AMD CPU.

Sadly I do not have any AMD machines, so I am having trouble debugging this.

Is there any reason why code compiled on an Intel CPU would crash on an AMD?
What can I look at to fix this?

Source: Windows Questions C++

LEAVE A COMMENT