public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/53515] New: InputIterator version std::advance needs positive check
@ 2012-05-29 8:35 faithandbrave at gmail dot com
2012-05-29 9:36 ` [Bug libstdc++/53515] InputIterator version std::advance needs negative check redi at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: faithandbrave at gmail dot com @ 2012-05-29 8:35 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53515
Bug #: 53515
Summary: InputIterator version std::advance needs positive
check
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: faithandbrave@gmail.com
C++11 specification 24.4.4
template <class InputIterator, class Distance>
void advance(InputIterator& i, Distance n);
Requires: n shall be negative only for bidirectional and random access
iterators.
==
libstdc++ std::advance is nothing positive check.
I think InputIterator version std::advance needs positive check.
before code:
template<typename _InputIterator, typename _Distance>
inline void
__advance(_InputIterator& __i, _Distance __n, input_iterator_tag)
{
// concept requirements
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
while (__n--)
++__i;
}
after code (add assert):
template<typename _InputIterator, typename _Distance>
inline void
__advance(_InputIterator& __i, _Distance __n, input_iterator_tag)
{
// concept requirements
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
_GLIBCXX_DEBUG_ASSERT(__n >= 0);
while (__n--)
++__i;
}
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libstdc++/53515] InputIterator version std::advance needs negative check
2012-05-29 8:35 [Bug libstdc++/53515] New: InputIterator version std::advance needs positive check faithandbrave at gmail dot com
@ 2012-05-29 9:36 ` redi at gcc dot gnu.org
2012-09-26 23:21 ` paolo.carlini at oracle dot com
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2012-05-29 9:36 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53515
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2012-05-29
Ever Confirmed|0 |1
Severity|normal |enhancement
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-05-29 09:27:34 UTC ---
Good idea, thanks
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libstdc++/53515] InputIterator version std::advance needs negative check
2012-05-29 8:35 [Bug libstdc++/53515] New: InputIterator version std::advance needs positive check faithandbrave at gmail dot com
2012-05-29 9:36 ` [Bug libstdc++/53515] InputIterator version std::advance needs negative check redi at gcc dot gnu.org
@ 2012-09-26 23:21 ` paolo.carlini at oracle dot com
2012-09-26 23:57 ` paolo at gcc dot gnu.org
2012-09-26 23:58 ` paolo.carlini at oracle dot com
3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-09-26 23:21 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53515
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
AssignedTo|unassigned at gcc dot |paolo.carlini at oracle dot
|gnu.org |com
Target Milestone|--- |4.8.0
--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-09-26 23:21:34 UTC ---
I'm going to test and apply this.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libstdc++/53515] InputIterator version std::advance needs negative check
2012-05-29 8:35 [Bug libstdc++/53515] New: InputIterator version std::advance needs positive check faithandbrave at gmail dot com
2012-05-29 9:36 ` [Bug libstdc++/53515] InputIterator version std::advance needs negative check redi at gcc dot gnu.org
2012-09-26 23:21 ` paolo.carlini at oracle dot com
@ 2012-09-26 23:57 ` paolo at gcc dot gnu.org
2012-09-26 23:58 ` paolo.carlini at oracle dot com
3 siblings, 0 replies; 5+ messages in thread
From: paolo at gcc dot gnu.org @ 2012-09-26 23:57 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53515
--- Comment #3 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> 2012-09-26 23:56:43 UTC ---
Author: paolo
Date: Wed Sep 26 23:56:39 2012
New Revision: 191784
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=191784
Log:
2012-09-26 Akira Takahashi <faithandbrave@gmail.com>
PR libstdc++/53515
* include/bits/stl_iterator_base_funcs.h (__advance(_InputIterator&,
_Distance, input_iterator_tag)): Add _GLIBCXX_DEBUG_ASSERT(__n >= 0).
Modified:
trunk/libstdc++-v3/ChangeLog
trunk/libstdc++-v3/include/bits/stl_iterator_base_funcs.h
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libstdc++/53515] InputIterator version std::advance needs negative check
2012-05-29 8:35 [Bug libstdc++/53515] New: InputIterator version std::advance needs positive check faithandbrave at gmail dot com
` (2 preceding siblings ...)
2012-09-26 23:57 ` paolo at gcc dot gnu.org
@ 2012-09-26 23:58 ` paolo.carlini at oracle dot com
3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-09-26 23:58 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53515
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-09-26 23:57:29 UTC ---
Done.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-09-26 23:58 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-29 8:35 [Bug libstdc++/53515] New: InputIterator version std::advance needs positive check faithandbrave at gmail dot com
2012-05-29 9:36 ` [Bug libstdc++/53515] InputIterator version std::advance needs negative check redi at gcc dot gnu.org
2012-09-26 23:21 ` paolo.carlini at oracle dot com
2012-09-26 23:57 ` paolo at gcc dot gnu.org
2012-09-26 23:58 ` paolo.carlini at oracle dot com
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).