public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/61512] New: libstd++ postfix operator hangs
@ 2014-06-15 15:30 srohit.pda at gmail dot com
2014-06-15 16:44 ` [Bug c++/61512] " glisse at gcc dot gnu.org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: srohit.pda at gmail dot com @ 2014-06-15 15:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61512
Bug ID: 61512
Summary: libstd++ postfix operator hangs
Product: gcc
Version: 4.4.7
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: srohit.pda at gmail dot com
Created attachment 32942
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=32942&action=edit
testcase files- source code, pre-processed code, assembly code, object code and
executable
Following code hangs forever in postfix operator.
#include <iostream>
#include <set>
int main()
{
std::set<int> empty;
std::set<int>::iterator iter = empty.begin() ;
while (iter++ != empty.end())
{
std::cout << *iter << "\n";
}
return 0;
}
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/61512] libstd++ postfix operator hangs
2014-06-15 15:30 [Bug c++/61512] New: libstd++ postfix operator hangs srohit.pda at gmail dot com
@ 2014-06-15 16:44 ` glisse at gcc dot gnu.org
2014-06-16 0:09 ` srohit.pda at gmail dot com
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: glisse at gcc dot gnu.org @ 2014-06-15 16:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61512
--- Comment #1 from Marc Glisse <glisse at gcc dot gnu.org> ---
You are not allowed to call ++ on an iterator if calling * on it would be
illegal.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/61512] libstd++ postfix operator hangs
2014-06-15 15:30 [Bug c++/61512] New: libstd++ postfix operator hangs srohit.pda at gmail dot com
2014-06-15 16:44 ` [Bug c++/61512] " glisse at gcc dot gnu.org
@ 2014-06-16 0:09 ` srohit.pda at gmail dot com
2014-06-16 4:43 ` glisse at gcc dot gnu.org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: srohit.pda at gmail dot com @ 2014-06-16 0:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61512
--- Comment #2 from Rohit Sharma <srohit.pda at gmail dot com> ---
(In reply to Marc Glisse from comment #1)
> You are not allowed to call ++ on an iterator if calling * on it would be
> illegal.
I may agree to your comment Marc.
Hanging code is manifestation is a sure bug - either in libstdc++ or gcc. Do
you agree?
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/61512] libstd++ postfix operator hangs
2014-06-15 15:30 [Bug c++/61512] New: libstd++ postfix operator hangs srohit.pda at gmail dot com
2014-06-15 16:44 ` [Bug c++/61512] " glisse at gcc dot gnu.org
2014-06-16 0:09 ` srohit.pda at gmail dot com
@ 2014-06-16 4:43 ` glisse at gcc dot gnu.org
2014-06-16 7:17 ` redi at gcc dot gnu.org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: glisse at gcc dot gnu.org @ 2014-06-16 4:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61512
--- Comment #3 from Marc Glisse <glisse at gcc dot gnu.org> ---
No, the bug is in your code. Try compiling with -D_GLIBCXX_DEBUG for a more
meaningful output.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/61512] libstd++ postfix operator hangs
2014-06-15 15:30 [Bug c++/61512] New: libstd++ postfix operator hangs srohit.pda at gmail dot com
` (2 preceding siblings ...)
2014-06-16 4:43 ` glisse at gcc dot gnu.org
@ 2014-06-16 7:17 ` redi at gcc dot gnu.org
2014-06-16 13:39 ` srohit.pda at gmail dot com
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2014-06-16 7:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61512
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |INVALID
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Invalid, do not increment a non-incrementable iterator.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/61512] libstd++ postfix operator hangs
2014-06-15 15:30 [Bug c++/61512] New: libstd++ postfix operator hangs srohit.pda at gmail dot com
` (3 preceding siblings ...)
2014-06-16 7:17 ` redi at gcc dot gnu.org
@ 2014-06-16 13:39 ` srohit.pda at gmail dot com
2014-06-16 17:14 ` glisse at gcc dot gnu.org
2014-06-16 17:32 ` srohit.pda at gmail dot com
6 siblings, 0 replies; 8+ messages in thread
From: srohit.pda at gmail dot com @ 2014-06-16 13:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61512
--- Comment #5 from Rohit Sharma <srohit.pda at gmail dot com> ---
Thank you Marc for the flag.
Compiling with that flag and running it, code "abort (core dumped)" - which I
take is reasonable behavior on a bad code.
bests.
-Rohit
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/61512] libstd++ postfix operator hangs
2014-06-15 15:30 [Bug c++/61512] New: libstd++ postfix operator hangs srohit.pda at gmail dot com
` (4 preceding siblings ...)
2014-06-16 13:39 ` srohit.pda at gmail dot com
@ 2014-06-16 17:14 ` glisse at gcc dot gnu.org
2014-06-16 17:32 ` srohit.pda at gmail dot com
6 siblings, 0 replies; 8+ messages in thread
From: glisse at gcc dot gnu.org @ 2014-06-16 17:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61512
--- Comment #6 from Marc Glisse <glisse at gcc dot gnu.org> ---
Really? With _GLIBCXX_DEBUG, your program is supposed to print the following
message (even with the old gcc-4.4 you reported this against):
/usr/include/c++/4.8/debug/safe_iterator.h:307:error: attempt to increment
a past-the-end iterator.
Objects involved in the operation:
iterator "this" @ 0x0x7fff4a666fb0 {
type =
N11__gnu_debug14_Safe_iteratorISt23_Rb_tree_const_iteratorIiENSt7__debug3setIiSt4lessIiESaIiEEEEE
(mutable iterator);
state = past-the-end;
references sequence with type `NSt7__debug3setIiSt4lessIiESaIiEEE' @
0x0x7fff4a666fe0
}
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/61512] libstd++ postfix operator hangs
2014-06-15 15:30 [Bug c++/61512] New: libstd++ postfix operator hangs srohit.pda at gmail dot com
` (5 preceding siblings ...)
2014-06-16 17:14 ` glisse at gcc dot gnu.org
@ 2014-06-16 17:32 ` srohit.pda at gmail dot com
6 siblings, 0 replies; 8+ messages in thread
From: srohit.pda at gmail dot com @ 2014-06-16 17:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61512
--- Comment #7 from Rohit Sharma <srohit.pda at gmail dot com> ---
Yes, it did print that message clearly before core-dump.
thank you much.
-Rohit
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2014-06-16 17:32 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-15 15:30 [Bug c++/61512] New: libstd++ postfix operator hangs srohit.pda at gmail dot com
2014-06-15 16:44 ` [Bug c++/61512] " glisse at gcc dot gnu.org
2014-06-16 0:09 ` srohit.pda at gmail dot com
2014-06-16 4:43 ` glisse at gcc dot gnu.org
2014-06-16 7:17 ` redi at gcc dot gnu.org
2014-06-16 13:39 ` srohit.pda at gmail dot com
2014-06-16 17:14 ` glisse at gcc dot gnu.org
2014-06-16 17:32 ` srohit.pda at gmail 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).