public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/51811] New: [C++0x] Incorrect incrementation/decrementation of atomic pointers
@ 2012-01-10 14:22 t.schuele at web dot de
2012-02-03 19:41 ` [Bug libstdc++/51811] " bkoz at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: t.schuele at web dot de @ 2012-01-10 14:22 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51811
Bug #: 51811
Summary: [C++0x] Incorrect incrementation/decrementation of
atomic pointers
Classification: Unclassified
Product: gcc
Version: 4.6.2
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: libstdc++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: t.schuele@web.de
Incrementation (decrementation) of atomic pointers does not work correctly. On
an x86-64 machine the piece of code given below produces the following output
(or something similar):
0x7fffbe6d082c
0x7fffbe6d082d
0x7fffbe6d0830
0x7fffbe6d082d
There are two problems here: Firstly, the pointer is incremented by 1 and not
by sizeof(int). Secondly, the last two lines of the output should be the same.
Note that the second problem seems to be fixed in gcc-4.7-20120107, while the
first one still occurs. Thanks for your help!
----------------------------
#include <iostream>
#include <atomic>
using namespace std;
int main(int argc, char* argv[]) {
int value = 42;
atomic<int*> my_pointer;
my_pointer = &value;
cout << my_pointer++ << endl;
cout << my_pointer << endl;
my_pointer = &value;
cout << ++my_pointer << endl;
cout << my_pointer << endl;
}
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libstdc++/51811] [C++0x] Incorrect incrementation/decrementation of atomic pointers
2012-01-10 14:22 [Bug libstdc++/51811] New: [C++0x] Incorrect incrementation/decrementation of atomic pointers t.schuele at web dot de
@ 2012-02-03 19:41 ` bkoz at gcc dot gnu.org
2012-02-03 19:49 ` bkoz at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: bkoz at gcc dot gnu.org @ 2012-02-03 19:41 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51811
Benjamin Kosnik <bkoz at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2012-02-03
CC| |bkoz at gcc dot gnu.org
AssignedTo|unassigned at gcc dot |bkoz at gcc dot gnu.org
|gnu.org |
Target Milestone|--- |4.7.0
Ever Confirmed|0 |1
--- Comment #1 from Benjamin Kosnik <bkoz at gcc dot gnu.org> 2012-02-03 19:41:00 UTC ---
Mine
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libstdc++/51811] [C++0x] Incorrect incrementation/decrementation of atomic pointers
2012-01-10 14:22 [Bug libstdc++/51811] New: [C++0x] Incorrect incrementation/decrementation of atomic pointers t.schuele at web dot de
2012-02-03 19:41 ` [Bug libstdc++/51811] " bkoz at gcc dot gnu.org
@ 2012-02-03 19:49 ` bkoz at gcc dot gnu.org
2012-02-15 3:02 ` bkoz at gcc dot gnu.org
2012-07-20 17:28 ` [Bug libstdc++/51811] [C++0x] Incorrect increment/decrement " jingyu at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: bkoz at gcc dot gnu.org @ 2012-02-03 19:49 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51811
--- Comment #2 from Benjamin Kosnik <bkoz at gcc dot gnu.org> 2012-02-03 19:49:17 UTC ---
Author: bkoz
Date: Fri Feb 3 19:49:11 2012
New Revision: 183875
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=183875
Log:
2012-02-03 Benjamin Kosnik <bkoz@redhat.com>
PR libstdc++/51811
* include/bits/atomic_base.h (atomic<_Tp*>): Fix offsets.
* testsuite/29_atomics/atomic/operators/51811.cc: New.
* testsuite/29_atomics/atomic/operators/pointer_partial_void.cc: New.
Added:
trunk/libstdc++-v3/testsuite/29_atomics/atomic/operators/51811.cc
trunk/libstdc++-v3/testsuite/29_atomics/atomic/operators/pointer_partial_void.cc
Modified:
trunk/libstdc++-v3/ChangeLog
trunk/libstdc++-v3/include/bits/atomic_base.h
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libstdc++/51811] [C++0x] Incorrect incrementation/decrementation of atomic pointers
2012-01-10 14:22 [Bug libstdc++/51811] New: [C++0x] Incorrect incrementation/decrementation of atomic pointers t.schuele at web dot de
2012-02-03 19:41 ` [Bug libstdc++/51811] " bkoz at gcc dot gnu.org
2012-02-03 19:49 ` bkoz at gcc dot gnu.org
@ 2012-02-15 3:02 ` bkoz at gcc dot gnu.org
2012-07-20 17:28 ` [Bug libstdc++/51811] [C++0x] Incorrect increment/decrement " jingyu at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: bkoz at gcc dot gnu.org @ 2012-02-15 3:02 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51811
Benjamin Kosnik <bkoz at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
--- Comment #3 from Benjamin Kosnik <bkoz at gcc dot gnu.org> 2012-02-15 03:01:50 UTC ---
Fixed for 4.7
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libstdc++/51811] [C++0x] Incorrect increment/decrement of atomic pointers
2012-01-10 14:22 [Bug libstdc++/51811] New: [C++0x] Incorrect incrementation/decrementation of atomic pointers t.schuele at web dot de
` (2 preceding siblings ...)
2012-02-15 3:02 ` bkoz at gcc dot gnu.org
@ 2012-07-20 17:28 ` jingyu at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: jingyu at gcc dot gnu.org @ 2012-07-20 17:28 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51811
--- Comment #4 from Jing Yu <jingyu at gcc dot gnu.org> 2012-07-20 17:28:09 UTC ---
Author: jingyu
Date: Fri Jul 20 17:27:57 2012
New Revision: 189724
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=189724
Log:
2012-07-19 Jing Yu <jingyu@google.com>
Backport r183875 to fix wrong atomic<_Tp*> add_fetch.
PR libstdc++/51811, Google ref b/6702865
* include/bits/atomic_0.h (atomic<_Tp*>): Fix offsets.
* include/bits/atomic_2.h: Likewise.
* testsuite/29_atomics/atomic/operators/51811.cc: New.
* testsuite/29_atomics/atomic/operators/pointer_partial_void.cc: New.
Added:
branches/google/gcc-4_6/libstdc++-v3/testsuite/29_atomics/atomic/operators/51811.cc
branches/google/gcc-4_6/libstdc++-v3/testsuite/29_atomics/atomic/operators/pointer_partial_void.cc
Modified:
branches/google/gcc-4_6/libstdc++-v3/ChangeLog.google-4_6
branches/google/gcc-4_6/libstdc++-v3/include/bits/atomic_0.h
branches/google/gcc-4_6/libstdc++-v3/include/bits/atomic_2.h
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-07-20 17:28 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-10 14:22 [Bug libstdc++/51811] New: [C++0x] Incorrect incrementation/decrementation of atomic pointers t.schuele at web dot de
2012-02-03 19:41 ` [Bug libstdc++/51811] " bkoz at gcc dot gnu.org
2012-02-03 19:49 ` bkoz at gcc dot gnu.org
2012-02-15 3:02 ` bkoz at gcc dot gnu.org
2012-07-20 17:28 ` [Bug libstdc++/51811] [C++0x] Incorrect increment/decrement " jingyu at gcc dot gnu.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).