Possible bug in vector<bool> in Visual Studio .NET 2003 
Author Message
 Possible bug in vector<bool> in Visual Studio .NET 2003

Hi,
  I've encountered a problem with the version of vector<bool> shipped with
Visual Studio .NET 2003 which causes an access violation. The reproduction
case is incredibly simple

#include <vector>

int main(int argc, char* argv[])
{
std::vector<bool> v(32, true);
v.back() = true; // access violation here
return 0;

Quote:
}

Change the vector type to int and it works correctly. Change the initial
vector size to 31 or 33 elements and it works correctly. 64 elements also
fails. It seems to be independent of compiler settings. I've reproduced it
in both debug and release builds of a new Win32 console application as well
as our main application which is where we first spotted it.

Switch to STLPort v4.5.3 and it works correctly.

Can someone confirm this so that I know I've not missed something - it seems
to simple to believe right now.

Steve.
----
Please remove "nospam." before replying by email



Sat, 29 Oct 2005 17:26:19 GMT  
 Possible bug in vector<bool> in Visual Studio .NET 2003

Quote:
>   I've encountered a problem with the version of vector<bool> shipped with
> Visual Studio .NET 2003 which causes an access violation. The reproduction
> case is incredibly simple

> #include <vector>

> int main(int argc, char* argv[])
> {
> std::vector<bool> v(32, true);
> v.back() = true; // access violation here
> return 0;
> }

> Change the vector type to int and it works correctly. Change the initial
> vector size to 31 or 33 elements and it works correctly. 64 elements also
> fails. It seems to be independent of compiler settings. I've reproduced it
> in both debug and release builds of a new Win32 console application as well
> as our main application which is where we first spotted it.

> Switch to STLPort v4.5.3 and it works correctly.

> Can someone confirm this so that I know I've not missed something - it seems
> to simple to believe right now.

Yes, it's a bug, caused by a botched edit while trying to fix a subtler
bug. You need to replace the code in vector<bool>const_iterator::operator+=
with:

  const_iterator& operator+=(difference_type _Off)
   { // increment by integer
   if (_Off < 0 && this->_Myoff < 0 - (size_type)_Off)
    { /* add negative increment */
    this->_Myoff += _Off;
    this->_Myptr -= 1 + ((size_type)(-1) - this->_Myoff) / _VBITS;
    this->_Myoff %= _VBITS;
    }
   else
    { /* add non-negative increment */
    this->_Myoff += _Off;
    this->_Myptr += this->_Myoff / _VBITS;
    this->_Myoff %= _VBITS;
    }
   return (*this);
   }

P.J. Plauger
Dinkumware, Ltd.
http://www.dinkumware.com



Sat, 29 Oct 2005 20:58:54 GMT  
 Possible bug in vector<bool> in Visual Studio .NET 2003
Thanks for the quick response.

Steve.


Quote:


> >   I've encountered a problem with the version of vector<bool> shipped
with
> > Visual Studio .NET 2003 which causes an access violation. The
reproduction
> > case is incredibly simple

> > #include <vector>

> > int main(int argc, char* argv[])
> > {
> > std::vector<bool> v(32, true);
> > v.back() = true; // access violation here
> > return 0;
> > }

> > Change the vector type to int and it works correctly. Change the initial
> > vector size to 31 or 33 elements and it works correctly. 64 elements
also
> > fails. It seems to be independent of compiler settings. I've reproduced
it
> > in both debug and release builds of a new Win32 console application as
well
> > as our main application which is where we first spotted it.

> > Switch to STLPort v4.5.3 and it works correctly.

> > Can someone confirm this so that I know I've not missed something - it
seems
> > to simple to believe right now.

> Yes, it's a bug, caused by a botched edit while trying to fix a subtler
> bug. You need to replace the code in

vector<bool>const_iterator::operator+=

- Show quoted text -

Quote:
> with:

>   const_iterator& operator+=(difference_type _Off)
>    { // increment by integer
>    if (_Off < 0 && this->_Myoff < 0 - (size_type)_Off)
>     { /* add negative increment */
>     this->_Myoff += _Off;
>     this->_Myptr -= 1 + ((size_type)(-1) - this->_Myoff) / _VBITS;
>     this->_Myoff %= _VBITS;
>     }
>    else
>     { /* add non-negative increment */
>     this->_Myoff += _Off;
>     this->_Myptr += this->_Myoff / _VBITS;
>     this->_Myoff %= _VBITS;
>     }
>    return (*this);
>    }

> P.J. Plauger
> Dinkumware, Ltd.
> http://www.dinkumware.com



Sun, 30 Oct 2005 00:15:14 GMT  
 Possible bug in vector<bool> in Visual Studio .NET 2003


Quote:
> Yes, it's a bug, caused by a botched edit while trying to fix a subtler
> bug. You need to replace the code in vector<bool>const_iterator::operator+=
> with:

>   const_iterator& operator+=(difference_type _Off)
>    { // increment by integer
>    if (_Off < 0 && this->_Myoff < 0 - (size_type)_Off)
>     { /* add negative increment */
>     this->_Myoff += _Off;
>     this->_Myptr -= 1 + ((size_type)(-1) - this->_Myoff) / _VBITS;
>     this->_Myoff %= _VBITS;
>     }
>    else
>     { /* add non-negative increment */
>     this->_Myoff += _Off;
>     this->_Myptr += this->_Myoff / _VBITS;
>     this->_Myoff %= _VBITS;
>     }
>    return (*this);
>    }

Will Dinkumware be publishing this fix and its
bretherin on the company's website?  I've been
collecting them, but the procedure is a little
dicey across product updates.  My fond hope is
that you will do something similar to the fixes
for VC6's library.

--
-Larry Brasfield
(address munged, s/sn/h/ to reply)



Sun, 30 Oct 2005 01:57:50 GMT  
 Possible bug in vector<bool> in Visual Studio .NET 2003

Quote:


> > Yes, it's a bug, caused by a botched edit while trying to fix a subtler
> > bug. You need to replace the code in vector<bool>const_iterator::operator+=
> > with:

> >   const_iterator& operator+=(difference_type _Off)
> >    { // increment by integer
> >    if (_Off < 0 && this->_Myoff < 0 - (size_type)_Off)
> >     { /* add negative increment */
> >     this->_Myoff += _Off;
> >     this->_Myptr -= 1 + ((size_type)(-1) - this->_Myoff) / _VBITS;
> >     this->_Myoff %= _VBITS;
> >     }
> >    else
> >     { /* add non-negative increment */
> >     this->_Myoff += _Off;
> >     this->_Myptr += this->_Myoff / _VBITS;
> >     this->_Myoff %= _VBITS;
> >     }
> >    return (*this);
> >    }

> Will Dinkumware be publishing this fix and its
> bretherin on the company's website?  I've been
> collecting them, but the procedure is a little
> dicey across product updates.  My fond hope is
> that you will do something similar to the fixes
> for VC6's library.

Probably not. We have a much closer working relationship with
Microsoft these days, so the need for an independent source
of bug fixes is greatly reduced.

P.J. Plauger
Dinkumware, Ltd.
http://www.dinkumware.com



Sun, 30 Oct 2005 05:09:08 GMT  
 Possible bug in vector<bool> in Visual Studio .NET 2003

Quote:

> Probably not. We have a much closer working relationship with
> Microsoft these days, so the need for an independent source
> of bug fixes is greatly reduced.

Does mean we won't see this fix until Microsoft makes a service pack
for VS.NET 2003? Which, I reckon must be at least several months away?

Or, worse still, they may decide to call it a new version of compiler
and ask money for that?

IMHO, quick fixes published on a web site is **MUCH** better than
waiting for MS service pack or next release.

Ivan



Sun, 30 Oct 2005 08:33:11 GMT  
 Possible bug in vector<bool> in Visual Studio .NET 2003

Quote:
> > Will Dinkumware be publishing this fix and its
> > bretherin on the company's website?  I've been
> > collecting them, but the procedure is a little
> > dicey across product updates.  My fond hope is
> > that you will do something similar to the fixes
> > for VC6's library.

> Probably not. We have a much closer working relationship with
> Microsoft these days, so the need for an independent source
> of bug fixes is greatly reduced.

Well if you offer no fixes on Dinkumwares web site then I hope we start
seeing fixes in Microsoft service packs. For VC6, I cannot recall seeing any
fixes to the template collection classes in any of the 5 SP's yet Dinkumware
did offer them on the web site.

This is more a criticism of Microsoft than Dinkumware. It is simply not good
enough to say, "It will be fixed in the next major release". After 7.1, I
suspect there will be a long wait.

Stephen Howe



Sun, 30 Oct 2005 21:42:26 GMT  
 Possible bug in vector<bool> in Visual Studio .NET 2003

Quote:

> Well if you offer no fixes on Dinkumwares web site then I hope we start
> seeing fixes in Microsoft service packs. For VC6, I cannot recall seeing any
> fixes to the template collection classes in any of the 5 SP's yet Dinkumware
> did offer them on the web site.

> This is more a criticism of Microsoft than Dinkumware. It is simply not good
> enough to say, "It will be fixed in the next major release". After 7.1, I
> suspect there will be a long wait.

I don't think it was Microsoft's fault (or Dinkumware's)...I seem to recall it
being related to this:

http://web.archive.org/web/20020228073306/http://www.dinkumware.com/l...

Ken



Sun, 30 Oct 2005 22:46:15 GMT  
 Possible bug in vector<bool> in Visual Studio .NET 2003
Quote:
> I don't think it was Microsoft's fault (or Dinkumware's)...I seem to
recall it
> being related to this:

http://web.archive.org/web/20020228073306/http://www.dinkumware.com/l...

That was July 98, nearly 5 years ago. VC6 service packs have been issued
over the past 5 years subsequent to that court case. Bugs fixes could have
been released by Microsoft in SP's for VC6 but were not. But it does not
matter as we could download fixes from Dinkumwares site for VC6 which
pleases me. If Dinkumware are not going to release bug fixes on their web
site anymore, then for 7.1 I hope bug fixes will _start_ occuring in SP's
for 7.1. I don't really understand Microsoft's reticience in releasing SP's
that fix parts of 7.1 but not the library parts that they subcontract off
Dinkumware.

Cheers

Stephen Howe



Mon, 31 Oct 2005 02:17:21 GMT  
 Possible bug in vector<bool> in Visual Studio .NET 2003
There is no reticence in fixing library bugs in an SP for any VC 7.0 and
later release.

Ronald Laeremans
Visual C++ team


Quote:
> > I don't think it was Microsoft's fault (or Dinkumware's)...I seem to
> recall it
> > being related to this:

http://web.archive.org/web/20020228073306/http://www.dinkumware.com/l....
html
Quote:

> That was July 98, nearly 5 years ago. VC6 service packs have been issued
> over the past 5 years subsequent to that court case. Bugs fixes could have
> been released by Microsoft in SP's for VC6 but were not. But it does not
> matter as we could download fixes from Dinkumwares site for VC6 which
> pleases me. If Dinkumware are not going to release bug fixes on their web
> site anymore, then for 7.1 I hope bug fixes will _start_ occuring in SP's
> for 7.1. I don't really understand Microsoft's reticience in releasing
SP's
> that fix parts of 7.1 but not the library parts that they subcontract off
> Dinkumware.

> Cheers

> Stephen Howe



Tue, 01 Nov 2005 10:10:02 GMT  
 Possible bug in vector<bool> in Visual Studio .NET 2003
Hi!

Then please send/post new mfc70.dll and mfc71.dll with all the known and
reported bugs fixed please. Many mfc71 bugs were discovered during beta
testing well before the release.

I consider MFC equal to the STL library in importance.

/Anders
P.s.
This is off topic but I feel its relevant.
D.s.



Quote:
> There is no reticence in fixing library bugs in an SP for any VC 7.0 and
> later release.

> Ronald Laeremans
> Visual C++ team



> > > I don't think it was Microsoft's fault (or Dinkumware's)...I seem to
> > recall it
> > > being related to this:

http://web.archive.org/web/20020228073306/http://www.dinkumware.com/l....
Quote:
> html

> > That was July 98, nearly 5 years ago. VC6 service packs have been issued
> > over the past 5 years subsequent to that court case. Bugs fixes could
have
> > been released by Microsoft in SP's for VC6 but were not. But it does not
> > matter as we could download fixes from Dinkumwares site for VC6 which
> > pleases me. If Dinkumware are not going to release bug fixes on their
web
> > site anymore, then for 7.1 I hope bug fixes will _start_ occuring in
SP's
> > for 7.1. I don't really understand Microsoft's reticience in releasing
> SP's
> > that fix parts of 7.1 but not the library parts that they subcontract
off
> > Dinkumware.

> > Cheers

> > Stephen Howe



Tue, 01 Nov 2005 13:20:20 GMT  
 Possible bug in vector<bool> in Visual Studio .NET 2003
We fix critical bugs and critical bugs only in service packs. That has been
the policy for basically forever and isn't changing. What also isn't
changing is the SP delivery mechanism which is one global service pack for
all of VS.

If you have a specific blocking bug and can't wait for a service pack,
contact product support. We have a hotfix/QFE mechanism to help in these
situations and product support is the entry to that mechanism. Calls that
are (only) about bugs in the product are free.

Ronald


Quote:
> Hi!

> Then please send/post new mfc70.dll and mfc71.dll with all the known and
> reported bugs fixed please. Many mfc71 bugs were discovered during beta
> testing well before the release.

> I consider MFC equal to the STL library in importance.

> /Anders
> P.s.
> This is off topic but I feel its relevant.
> D.s.



> > There is no reticence in fixing library bugs in an SP for any VC 7.0 and
> > later release.

> > Ronald Laeremans
> > Visual C++ team



> > > > I don't think it was Microsoft's fault (or Dinkumware's)...I seem to
> > > recall it
> > > > being related to this:

http://web.archive.org/web/20020228073306/http://www.dinkumware.com/l....

- Show quoted text -

Quote:
> > html

> > > That was July 98, nearly 5 years ago. VC6 service packs have been
issued
> > > over the past 5 years subsequent to that court case. Bugs fixes could
> have
> > > been released by Microsoft in SP's for VC6 but were not. But it does
not
> > > matter as we could download fixes from Dinkumwares site for VC6 which
> > > pleases me. If Dinkumware are not going to release bug fixes on their
> web
> > > site anymore, then for 7.1 I hope bug fixes will _start_ occuring in
> SP's
> > > for 7.1. I don't really understand Microsoft's reticience in releasing
> > SP's
> > > that fix parts of 7.1 but not the library parts that they subcontract
> off
> > > Dinkumware.

> > > Cheers

> > > Stephen Howe



Wed, 02 Nov 2005 01:56:51 GMT  
 Possible bug in vector<bool> in Visual Studio .NET 2003

Quote:
> There is no reticence in fixing library bugs in an SP for any VC 7.0 and
> later release.

> Ronald Laeremans
> Visual C++ team

Well I am glad to hear it.

Because it was certainly the case that none of the fixes on Dinkumwares site
for VC6 ever appeared in any of the VC Service Packs. They should have been.
So that is a change of policy on Microsoft's part.

Stephen Howe



Wed, 02 Nov 2005 08:24:32 GMT  
 Possible bug in vector<bool> in Visual Studio .NET 2003
I don't mean to belabor the point, but does Microsoft have an internal
definition as to what constitutes a 'critical bug'?  Also, is there a
publically available list of bugs to be fixed in the next service
pack?

Thanks,

Jeff


Quote:
> We fix critical bugs and critical bugs only in service packs. That has been
> the policy for basically forever and isn't changing. What also isn't
> changing is the SP delivery mechanism which is one global service pack for
> all of VS.

> If you have a specific blocking bug and can't wait for a service pack,
> contact product support. We have a hotfix/QFE mechanism to help in these
> situations and product support is the entry to that mechanism. Calls that
> are (only) about bugs in the product are free.

> Ronald



Fri, 04 Nov 2005 14:28:17 GMT  
 Possible bug in vector<bool> in Visual Studio .NET 2003
And just to labour the point theres a lot of people still using vc6 due too
being to late in the dev cycle to change over (our project is gonna run 3
years in total and we've still got one to go but with major milestones
littered through it making it too risky to change, We did try, hit some bugs
in .net 2002 and ran back to vc6 again). It would be nice if ms could
distribute all of the bug fixes to the stl for it. We are loathed to put
them in by hand as this will mean we have to put the whole stl into source
control and still run the risk of silly bugs cropping up from people
compiling with the wrong version. If its in a service pack or similar we can
expect people to install it.

Martin


Quote:
> > There is no reticence in fixing library bugs in an SP for any VC 7.0 and
> > later release.

> > Ronald Laeremans
> > Visual C++ team

> Well I am glad to hear it.

> Because it was certainly the case that none of the fixes on Dinkumwares
site
> for VC6 ever appeared in any of the VC Service Packs. They should have
been.
> So that is a change of policy on Microsoft's part.

> Stephen Howe



Sun, 20 Nov 2005 19:27:11 GMT  
 
 [ 16 post ]  Go to page: [1] [2]

 Relevant Pages 

1. Possible bug in vector<bool> in Visual Studio .NET 2003

2. optimizer bug in VC7.1 final beta Visual Studio .Net 2003

3. operator<<() overload with Visual Studio 2003 C++

4. <<<Bug in Developer studio 2003 beta (Everett)>>>

5. Possible MC++ bug in VS.NET 2003

6. Possible C++ bug .NET 2003 Final Beta

7. (CP) Possible bug in math.h in VS.NET 2003 FB

8. Possible bug: MIDL properties missing in VS.NET 2003 Final Beta

9. (CP) Possible bug in math.h in VS.NET 2003 FB

10. PowerToys for Visual Studio .NET 2003 Project Announcement

11. Visual Studio .NET 2003 Problem

12. Visual Studio .Net 2003

 

 
Powered by phpBB® Forum Software