public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/11584] New: ios::iword() fails to zero-initialize storage on failure
@ 2003-07-18 23:10 sebor at roguewave dot com
  2003-07-29 16:56 ` [Bug libstdc++/11584] " ehrhardt at mathematik dot uni-ulm dot de
                   ` (15 more replies)
  0 siblings, 16 replies; 18+ messages in thread
From: sebor at roguewave dot com @ 2003-07-18 23:10 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11584

           Summary: ios::iword() fails to zero-initialize storage on failure
           Product: gcc
           Version: 3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sebor at roguewave dot com
                CC: gcc-bugs at gcc dot gnu dot org

According to 27.4.2.5, p3, of ISO/IEC 14882:2003, the program below is expected
to exit with the status of 0. It exits with a non-0 status when compiled with
gcc 3.2.

Regards
Martin

#include <stdlib.h>
#include <iostream>
#include <new>

int new_fails;

void* operator new (size_t n)
{
    if (new_fails)
        throw std::bad_alloc ();

    return malloc (n);
}

void operator delete (void *p) { free (p); }
void* operator new[] (size_t n) { return operator new (n); }
void operator delete[] (void *p) { operator delete (p); }

int main ()
{
    const int i = std::ios::xalloc ();

    new_fails = 1;

    std::cout.iword (i) = 0xdeadbeef;

    return std::cout.iword (i);
}


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2004-01-27 16:00 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-18 23:10 [Bug libstdc++/11584] New: ios::iword() fails to zero-initialize storage on failure sebor at roguewave dot com
2003-07-29 16:56 ` [Bug libstdc++/11584] " ehrhardt at mathematik dot uni-ulm dot de
2003-08-23  0:52 ` dhazeghi at yahoo dot com
2003-09-10 14:46 ` bkoz at gcc dot gnu dot org
2003-09-17 23:50 ` bkoz at gcc dot gnu dot org
2003-09-18 12:35   ` Christian Ehrhardt
2003-09-18 12:49 ` ehrhardt at mathematik dot uni-ulm dot de
2003-12-30 20:42 ` jlquinn at optonline dot net
2004-01-08 17:21 ` bkoz at gcc dot gnu dot org
2004-01-26  1:45 ` jlquinn at gcc dot gnu dot org
2004-01-26 20:36 ` bkoz at redhat dot com
2004-01-27  2:32 ` jlquinn at gcc dot gnu dot org
2004-01-27  2:33 ` jlquinn at gcc dot gnu dot org
2004-01-27  4:50 ` bkoz at redhat dot com
2004-01-27 15:46 ` cvs-commit at gcc dot gnu dot org
2004-01-27 15:54 ` cvs-commit at gcc dot gnu dot org
2004-01-27 15:55 ` jlquinn at gcc dot gnu dot org
2004-01-27 16:00 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).