Stack Corruption While Compiling with LTCG

0

I'm getting this weird crash that only happens when it's enabled. I'm fairly sure it's some sort of stack corruption, but the details of the crash are very strange.

void CMover::UpdateParts(int nSex, int nSkinSet, int nFace, int nHairMesh, int nHeadMesh,
PEQUIP_INFO pEquipInfo, CModelObject* pModel, ItemContainer* pEquipment, BOOL bIfParts,
CMover* pMover)
{
    if (pModel == nullptr) // returns false, aka in runtime, the pModel pointer isn't being evaluated to 0
    {
        MooLog::Write("CMover::UpdateParts : pModel is nullptr");
        return;
    }

    if (bIfParts)
    {
        // if I uncomment the following line, it won't crash for some reason
        //MooLog::Write("CMover::UpdateParts : pModel is %08X", 3);

        // Crashes on the following line accessing invalid memory(0x000000C0, which is the offset of m_nPartsIdx)
        // It's strange that pModel is evaluating to zero here, considering it was just checked a few lines prior.
        pModel->m_nPartsIdx = 0; 
    }
...
}

Assume singlethreaded app, seeing as no other threads would be writing at the time of this crash. Compiling with VC11 x86.

c++
visual-c++
compiler-optimization
asked on Stack Overflow Apr 10, 2015 by Zack Winter

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0