- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
The following code occasionally fails with bad allocation exception or unknow exception when I compile it with /EHa flag in Release configuration. It does not fail when I build it in Debug configuration and in all configurations with MS Visual C++ Compiler.
#include <vector>
#include <iostream>
using namespace std;
int main()
{
try
{
vector<wchar_t> v;
v.push_back( L'0' );
cout << "Ok" << endl;
}
catch( std::exception& e )
{
cout << "Failed with " << e.what() << endl;
}
}
I have run sample 20 times and 14 of them have fallen.
Intel(R) C++ Compiler XE, Version 12.1.3.300 Build 20120130
OS: Windows 7 Professinal with SP1 x64
Compiler options: /c /O2 /Oi /Qipo /D "_MBCS" /EHa /MD /GS /Gy /fp:fast /Fo"Release/" /Fd"Release/vc90.pdb" /W3 /nologo /Zi
What am I doing wrong? Could you help me please?
The sample project is attached.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have compiled code with Intel(R) C++ Compiler XE 13.1.2.190 [IA-32] and the same results have been repeated.
I have tried to use char instead wchar_t and the same results have been repeated again. But the issue is not reproduced when I use short and int types.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Unfortunately workaround fails.
D:\temporary\sample\sample>icl
Intel(R) C++ Compiler XE for applications running on IA-32, Version 12.1.3.300 B
uild 20120130
Copyright (C) 1985-2012 Intel Corporation. All rights reserved.
icl: command line error: no files specified; for help type "icl /help"
D:\temporary\sample\sample>icl.exe /O2 /Oi /Qipo /D "_MBCS" /EHa /MD /GS /Gy /fp:fast /W5 /nologo /Zi Sample.cpp
warning #13000: could not open message catalog file: diagscUI.dll
Sample.cpp
warning #13000: could not open message catalog file: diagscUI.dll
Sample.cpp(19): remark #981: operands are evaluated in unspecified order
cout << "Failed with " << e.what() << endl;
^
warning #13000: could not open message catalog file: diagscUI.dll
ipo: remark #11001: performing single-file optimizations
ipo: remark #11006: generating object file C:\Users\VTRUSH~1\AppData\Local\Temp\
ipo_91080.obj
D:\temporary\sample\sample>Sample.exe
Failed with bad allocation
Workaround fails with both Unicode Character Set and Multi-Byte Character Set compiler options.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Unfortunately, I don't know how to get the latest 12.x version but I've tried 13.1.2.190 version and sample fails with both Unicode Character Set and Multi-Byte Character Set compiler options.
D:\temporary\sample\sample>icl
Intel(R) C++ Compiler XE for applications running on IA-32, Version 13.1.2.190 Build 20130514
Copyright (C) 1985-2013 Intel Corporation. All rights reserved.
icl: command line error: no files specified; for help type "icl /help"
D:\temporary\sample\sample>icl.exe /O2 /Oi /Qipo /D "_MBCS" /EHa /MD /GS /Gy /fp:fast /W5 /nologo /Zi Sample.cpp
Sample.cpp
warning #13000: could not open message catalog file: diagscUI.dll
Sample.cpp(19): remark #981: operands are evaluated in unspecified order
cout << "Failed with " << e.what() << endl;
^
warning #13000: could not open message catalog file: diagscUI.dll
ipo: remark #11001: performing single-file optimizations
ipo: remark #11006: generating object file C:\Users\VTRUSH~1\AppData\Local\Temp\
ipo_92080.obj
D:\temporary\sample\sample>sample
Failed with bad allocation
D:\temporary\sample\sample>sample
Failed with bad allocation
D:\temporary\sample\sample>sample
Failed with bad allocation
D:\temporary\sample\sample>icl.exe /O2 /Oi /Qipo /D "_UNICODE" /D "UNICODE" /EHa /MD /GS /Gy /fp:fast /W5 /nologo /Zi Sample.cpp
Sample.cpp
warning #13000: could not open message catalog file: diagscUI.dll
Sample.cpp(19): remark #981: operands are evaluated in unspecified order
cout << "Failed with " << e.what() << endl;
^
warning #13000: could not open message catalog file: diagscUI.dll
ipo: remark #11001: performing single-file optimizations
ipo: remark #11006: generating object file C:\Users\VTRUSH~1\AppData\Local\Temp\
ipo_91168.obj
D:\temporary\sample\sample>sample
Failed with Unknown exception
D:\temporary\sample\sample>sample
Failed with Unknown exception
D:\temporary\sample\sample>sample
Failed with Unknown exception
If tests with the latest 12.x version are important, could you give me a link to that build please?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The issue is reproducible with the latest 12.x version.
D:\temporary\sample\sample>icl
Intel(R) C++ Compiler XE for applications running on IA-32, Version 12.1.7.371 B
uild 20120928
Copyright (C) 1985-2012 Intel Corporation. All rights reserved.
icl: command line error: no files specified; for help type "icl /help"
D:\temporary\sample\sample>icl.exe /O2 /Oi /Qipo /D "_MBCS" /EHa /MD /GS /G
y /fp:fast /W5 /nologo /Zi Sample.cpp
warning #13000: could not open message catalog file: diagscUI.dll
Sample.cpp
warning #13000: could not open message catalog file: diagscUI.dll
Sample.cpp(19): remark #981: operands are evaluated in unspecified order
cout << "Failed with " << e.what() << endl;
^
warning #13000: could not open message catalog file: diagscUI.dll
ipo: remark #11001: performing single-file optimizations
ipo: remark #11006: generating object file C:\Users\VTRUSH~1\AppData\Local\Temp\
ipo_95904.obj
D:\temporary\sample\sample>sample
Failed with bad allocation
D:\temporary\sample\sample>sample
Failed with bad allocation
D:\temporary\sample\sample>sample
Failed with bad allocation
D:\temporary\sample\sample>icl.exe /O2 /Oi /Qipo /D "_UNICODE" /D "UNICODE"
/EHa /MD /GS /Gy /fp:fast /W5 /nologo /Zi Sample.cpp
warning #13000: could not open message catalog file: diagscUI.dll
Sample.cpp
warning #13000: could not open message catalog file: diagscUI.dll
Sample.cpp(19): remark #981: operands are evaluated in unspecified order
cout << "Failed with " << e.what() << endl;
^
warning #13000: could not open message catalog file: diagscUI.dll
ipo: remark #11001: performing single-file optimizations
ipo: remark #11006: generating object file C:\Users\VTRUSH~1\AppData\Local\Temp\
ipo_95036.obj
D:\temporary\sample\sample>sample
Failed with Unknown exception
D:\temporary\sample\sample>sample
Failed with Unknown exception
D:\temporary\sample\sample>sample
Failed with Unknown exception
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have used "IA-32 Visual Studio 2008 mode". On that computer I have Windows 7 64-bit with Visual Studio Team System 2008.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The sample crashed in the following method of STL std::vector class:
template<class _Ty, class _Ax> class vector : public _Vector_val<_Ty, _Ax> {
...
void _Insert_n(const_iterator _Where, size_type _Count, const _Ty& _Val) {
...
pointer _Newvec = this->_Alval.allocate(_Capacity);
...
}
}
Crash line screen and build log are attached.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page