stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Sebor (JIRA)" <j...@apache.org>
Subject [jira] Updated: (STDCXX-79) [MSVC 7] operator new doesn't throw on failure
Date Wed, 29 Aug 2007 14:27:31 GMT

     [ https://issues.apache.org/jira/browse/STDCXX-79?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Martin Sebor updated STDCXX-79:
-------------------------------

    Affects Version/s:     (was: 4.1.2)

Removed 4..1.2 from Affected Versions -- this is a bug in the compiler, not in stdcxx.

> [MSVC 7] operator new doesn't throw on failure
> ----------------------------------------------
>
>                 Key: STDCXX-79
>                 URL: https://issues.apache.org/jira/browse/STDCXX-79
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: External
>         Environment: MSVC 7.0, 7.1
>            Reporter: Martin Sebor
>            Assignee: Farid Zaripov
>            Priority: Critical
>
> The implementation of operaror new in the MSVC 7 runtime library (but not the one in
the C++ Standard Library, msvcprtd), fails to throw an exception on failure and instead returns
0. This works correctly in MSVC 8.
> Here's a reference to the MSVC 7 documentation of their libraries:
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt_c_run.2d.time_libraries.asp
> $ cat t.cpp && cl /EHsc /MDd t.cpp /c && link /NODEFAULTLIB:msvcprtd
t.obj && ./t
> #include <cassert>
> #include <new>
> #include <crtdbg.h>
> int main ()
> {
>     _CrtSetReportMode (_CRT_WARN, _CRTDBG_MODE_DEBUG);
>     _CrtSetReportMode (_CRT_ERROR, _CRTDBG_MODE_DEBUG);
>     _CrtSetReportMode (_CRT_ASSERT, _CRTDBG_MODE_DEBUG);
>     int success = 0;
>     try {
>         operator new ((unsigned long)-1024);
>     }
>     catch (std::bad_alloc&) { success = 1; }
>     catch (...) { }
>     assert (success);
> }
> Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80x86
> Copyright (C) Microsoft Corporation 1984-2002. All rights reserved.
> t.cpp
> Microsoft (R) Incremental Linker Version 7.10.3077
> Copyright (C) Microsoft Corporation. All rights reserved.
> Assertion failed: success, file t.cpp, line 20
> This application has requested the Runtime to terminate it in an unusual way.
> Please contact the application's support team for more information.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message