public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: libstdc++/6282: bitset<0> results in nonsense behavior
@ 2002-04-12 13:28 pme
  0 siblings, 0 replies; 3+ messages in thread
From: pme @ 2002-04-12 13:28 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, pme

Synopsis: bitset<0> results in nonsense behavior

Responsible-Changed-From-To: unassigned->pme
Responsible-Changed-By: pme
Responsible-Changed-When: Fri Apr 12 13:28:49 2002
Responsible-Changed-Why:
    Well...
State-Changed-From-To: open->analyzed
State-Changed-By: pme
State-Changed-When: Fri Apr 12 13:28:49 2002
State-Changed-Why:
    Patch in progress.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6282


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

* Re: libstdc++/6282: bitset<0> results in nonsense behavior
@ 2002-05-24 11:22 pme
  0 siblings, 0 replies; 3+ messages in thread
From: pme @ 2002-05-24 11:22 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, pme

Synopsis: bitset<0> results in nonsense behavior

State-Changed-From-To: analyzed->closed
State-Changed-By: pme
State-Changed-When: Fri May 24 11:14:36 2002
State-Changed-Why:
    Fixed for 3.1.1 and later.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6282


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

* libstdc++/6282: bitset<0> results in nonsense behavior
@ 2002-04-12 13:16 pme
  0 siblings, 0 replies; 3+ messages in thread
From: pme @ 2002-04-12 13:16 UTC (permalink / raw)
  To: gcc-gnats


>Number:         6282
>Category:       libstdc++
>Synopsis:       bitset<0> results in nonsense behavior
>Confidential:   no
>Severity:       critical
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Apr 12 13:16:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Phil Edwards
>Release:        3.x
>Organization:
>Environment:
All.  (Not platform-specific code.)
>Description:
Creating a std::bitset instance of zero size still stores
a word's worth of data.

Consider

  std::bitset<1>  x(555555);
  int i = x.count();

Only the least significant bit from 555555 will be stored,
and i will correctly be set to 1 (the count of "on" bits
in x).  But if x is defined as

  std::bitset<0>  x(555555);

then there are still sizeof(unsigned long) bits being
stored and initialized, and x.count() returns 9 instead of
the more correct 0.  Other bitset member functions return
likewise silly results.


The base class for bitset is not taking into account the
empty case.
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


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

end of thread, other threads:[~2002-05-24 18:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-12 13:28 libstdc++/6282: bitset<0> results in nonsense behavior pme
  -- strict thread matches above, loose matches on Subject: below --
2002-05-24 11:22 pme
2002-04-12 13:16 pme

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).