Crashes in Intel C++ Compiler, doesn't crash in Microsoft VS2005 C++ Compiler -- HELP!
Hi everyone -- sort of weird problem. When I run this under the Microsoft VS2005
C++ compiler, everything is fine (both debug and release). When I debug it I do get an exception that I
pass to the application and never hear from it again.
Under the 11.0.066 Intel C++ compiler in Visual Studio 2005 when I run the
application, this crashes and I am not able to get out of the crash.
Here is the description, and I would appreciate it if anyone could give some suggestion of what
to do.
- Please read the following description of the problem. In the Microsoft C++ compiler, despite the
problem when I DEBUG it, I am able to pass the exception to the application and not get any more exceptions after that.
When I run the app (compiled under Microsoft VS2005 C++) I get no sign of any problem both in the debug and release
configurations. The only sign of a problem is when I DEBUG (F5) and then I get a first time exception that I pass to the
application and never hear from this again.
- However, When I compile in the Intel C++ compiler (11.0.066 - w_cproc_p_11.0.066_ia32.exe is the
install for it), when I run the application, in debug (ctrl F5) I get all kinds of assertions that I don't get in
Windows. When I run it in Release, these assertions do not appear, the program crashes and that's it.
- I would appreciate understanding either how to fix whatever problem there is, or to make the
compiler ignore this at run time just like in the Microsoft compiler.
- Please read more description below.
I have an MFC application in VS2005 with a CFormView.
There is a CDialogBar
(shown when the app comes up) on the left of the view. The DialogBar has a CPropertySheet with 2 CPropertyPage's on it.
The second CPropertyPage has a derived class from CListBox on it. I call it CMenuListBox because it has a
floating menu upon right clicks.
The CDialogBar is created when the application comes up in the main cpp
file: Runner.cpp as follows:
if (!ProcessShellCommand(cmdInfo)) return FALSE; //
The one and only window has been initialized, so show and update it m_pMainWnd->ShowWindow(SW_SHOW); m_pMainWnd->UpdateWindow(); // call DragAcceptFiles only if there's a suffix // In an SDI app, this should occur after
ProcessShellCommand ((CMainFrame*)m_pMainWnd)->OpenDialogs();
The CDialogBar that contains the CPropertySheet with the CPropertyPages as described above is a member of the
CMainFrame class (MainFrm.cpp).
OpenDialogs calls "create" for the CDialogBar (the member of CMainFrame:
m_pStatusDlg):
if(m_pStatusDlg==NULL) { m_pStatusDlg = new CStatusTabDlg(); m_pStatusDlg->Create(this,IDD_DIALOG_STATUS_TAB, CBRS_LEFT | CBRS_TOOLTIPS |
CBRS_FLYBY, IDD_DIALOG_STATUS_TAB);m_pStatusDlg->SetWindowText(_T("Status Tab
Dialog")); ShowControlBar(m_pStatusDlg,TRUE,FALSE); }
Now, when I debug this, when I push the tab for the second page (the statusDlg) I get an
error (which I will describe below). If I press break and then F5, I get "pass the exception to the current
application?" -- when I answer yes, everything goes on well. In Release mode and in Debug when I run as ctrl F5 there is
no mention of this "exception". SO I just left it as it is and that's that. WHen I compile using the Intel Compiler, I
get a crash -- so I have to fix this to get the Intel Compiler to work and see it's advantages...
The
exception that I get says: First chance exception at 0x5d0c373e in Runner.exe: 0xC0000005: Access violation
writing location 0x00875bbc.
The crash is in afxtls.cpp as follows:
inline void* CThreadSlotData::GetThreadValue(int nSlot) { EnterCriticalSection(&m_sect);
ASSERT(nSlot != 0 && nSlot < m_nMax); ASSERT(m_pSlotData != NULL);
ASSERT(m_pSlotData[nSlot].dwFlags & SLOT_USED); ASSERT(m_tlsIndex != (DWORD)-1);
if( nSlot <= 0 || nSlot >=
m_nMax ) // check for retail builds. { LeaveCriticalSection(&m_sect); return
NULL; } CThreadData* pData = (CThreadData*)TlsGetValue(m_tlsIndex); if
(pData == NULL || nSlot >= pData->nCount) {
LeaveCriticalSection(&m_sect); return NULL; }
void* pRetVal =
pData->pData[nSlot]; LeaveCriticalSection(&m_sect); <<<ß-----------HERE IS THE CRASH return pRetVal; }
This happens when I push on the tab button to go onto the second
page. If I try to access the page before in code, the crash happens then. If I put the page as the first page, it
happens immediately. I did have multiple resource indices, so I changed them to all be unique and still get the
crash. Has anyone seen anything like this?
Any ideas what this means or where this could come from?
Could this be a bug in the version of MFC that I have?
Thanks for any help with this.
|