public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/46207] New: std::atomic<const T *>::store(...) fails to compile
@ 2010-10-28  5:35 miles at gnu dot org
  2010-10-28  9:32 ` [Bug libstdc++/46207] " paolo.carlini at oracle dot com
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: miles at gnu dot org @ 2010-10-28  5:35 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46207

           Summary: std::atomic<const T *>::store(...) fails to compile
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: miles@gnu.org


The following program:


#include <atomic>

std::atomic<int *> non_const_int_pointer;
void non_const_set (int *value)
{
  non_const_int_pointer.store (value, std::memory_order_release);
}

#ifndef SUPPRESS_CONST
std::atomic<const int *> const_int_pointer;
void const_set (const int *value)
{
  const_int_pointer.store (value, std::memory_order_release);
}
#endif


compiled with options "-O2 -march=native -std=c++0x", gives an error and fails
to compile because of the call to "const_int_pointer.store" (see error log
below).

However, the program compiles successfully if I add "-DSUPPRESS_CONST" to the
compiler options -- the call of "non_const_int_pointer.store" does not seem to
cause any problems.


Error log:

$ g++-snapshot --version
g++ (Debian 20101016-1) 4.6.0 20101016 (experimental) [trunk revision 165538]
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ g++-snapshot -O2 -march=native -std=c++0x  -S al.cc
In file included from al.cc:1:0:
/usr/lib/gcc-snapshot/lib/gcc/x86_64-linux-gnu/4.6.0/../../../../include/c++/4.6.0/atomic:
In member function 'void std::atomic<_Tp*>::store(_Tp*, std::memory_order)
[with _Tp = const int, std::memory_order = std::memory_order]':
al.cc:13:60:   instantiated from here
/usr/lib/gcc-snapshot/lib/gcc/x86_64-linux-gnu/4.6.0/../../../../include/c++/4.6.0/atomic:145:9:
error: invalid conversion from 'const void*' to 'void*' [-fpermissive]
/usr/lib/gcc-snapshot/lib/gcc/x86_64-linux-gnu/4.6.0/../../../../include/c++/4.6.0/bits/atomic_2.h:99:5:
error:   initializing argument 1 of 'void
std::__atomic2::atomic_address::store(void*, std::memory_order)' [-fpermissive]

$ g++-snapshot -DSUPPRESS_CONST -O2 -march=native -std=c++0x  -S al.cc
$


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

* [Bug libstdc++/46207] std::atomic<const T *>::store(...) fails to compile
  2010-10-28  5:35 [Bug libstdc++/46207] New: std::atomic<const T *>::store(...) fails to compile miles at gnu dot org
@ 2010-10-28  9:32 ` paolo.carlini at oracle dot com
  2010-10-28  9:50 ` paolo.carlini at oracle dot com
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: paolo.carlini at oracle dot com @ 2010-10-28  9:32 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46207

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2010.10.28 09:32:14
         AssignedTo|unassigned at gcc dot       |paolo.carlini at oracle dot
                   |gnu.org                     |com
     Ever Confirmed|0                           |1

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> 2010-10-28 09:32:14 UTC ---
Seems just matter of adding a cast.


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

* [Bug libstdc++/46207] std::atomic<const T *>::store(...) fails to compile
  2010-10-28  5:35 [Bug libstdc++/46207] New: std::atomic<const T *>::store(...) fails to compile miles at gnu dot org
  2010-10-28  9:32 ` [Bug libstdc++/46207] " paolo.carlini at oracle dot com
@ 2010-10-28  9:50 ` paolo.carlini at oracle dot com
  2010-10-28  9:54 ` redi at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: paolo.carlini at oracle dot com @ 2010-10-28  9:50 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46207

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> 2010-10-28 09:50:37 UTC ---
Note, we have a much more general issue with atomic<_Tp*> vs atomic_address:
everywhere we are assuming _Tp is not cv-qualified and this is not going to
work with atomic_address, which takes plain void*.


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

* [Bug libstdc++/46207] std::atomic<const T *>::store(...) fails to compile
  2010-10-28  5:35 [Bug libstdc++/46207] New: std::atomic<const T *>::store(...) fails to compile miles at gnu dot org
  2010-10-28  9:32 ` [Bug libstdc++/46207] " paolo.carlini at oracle dot com
  2010-10-28  9:50 ` paolo.carlini at oracle dot com
@ 2010-10-28  9:54 ` redi at gcc dot gnu.org
  2010-10-28  9:59 ` paolo.carlini at oracle dot com
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: redi at gcc dot gnu.org @ 2010-10-28  9:54 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46207

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> 2010-10-28 09:54:24 UTC ---
http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#879


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

* [Bug libstdc++/46207] std::atomic<const T *>::store(...) fails to compile
  2010-10-28  5:35 [Bug libstdc++/46207] New: std::atomic<const T *>::store(...) fails to compile miles at gnu dot org
                   ` (2 preceding siblings ...)
  2010-10-28  9:54 ` redi at gcc dot gnu.org
@ 2010-10-28  9:59 ` paolo.carlini at oracle dot com
  2010-10-28 10:14 ` paolo.carlini at oracle dot com
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: paolo.carlini at oracle dot com @ 2010-10-28  9:59 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46207

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> 2010-10-28 09:59:43 UTC ---
Thanks Jon, much better implementing it ;)


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

* [Bug libstdc++/46207] std::atomic<const T *>::store(...) fails to compile
  2010-10-28  5:35 [Bug libstdc++/46207] New: std::atomic<const T *>::store(...) fails to compile miles at gnu dot org
                   ` (3 preceding siblings ...)
  2010-10-28  9:59 ` paolo.carlini at oracle dot com
@ 2010-10-28 10:14 ` paolo.carlini at oracle dot com
  2010-10-28 11:11 ` redi at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: paolo.carlini at oracle dot com @ 2010-10-28 10:14 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46207

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |NEW
                 CC|                            |bkoz at redhat dot com
         AssignedTo|paolo.carlini at oracle dot |unassigned at gcc dot
                   |com                         |gnu.org

--- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> 2010-10-28 10:14:02 UTC ---
It's a mess: why n3126 doesn't have the store, atomic_store, and
atomic_exchange tweaks, to name a few? Also, the compare_exchange_* are now
overloaded, not just changed to take a const void*. And what about the
atomic_address constructor from a void*? I don't think I'm going to work on
this righ now... Adding Benjamin in CC, maybe he followed details of this..


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

* [Bug libstdc++/46207] std::atomic<const T *>::store(...) fails to compile
  2010-10-28  5:35 [Bug libstdc++/46207] New: std::atomic<const T *>::store(...) fails to compile miles at gnu dot org
                   ` (4 preceding siblings ...)
  2010-10-28 10:14 ` paolo.carlini at oracle dot com
@ 2010-10-28 11:11 ` redi at gcc dot gnu.org
  2010-10-29 11:09 ` paolo.carlini at oracle dot com
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: redi at gcc dot gnu.org @ 2010-10-28 11:11 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46207

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> 2010-10-28 11:11:09 UTC ---
I haven't followed it, but it wouldn't surprise me if a few issues were closed
as NAD Editorial without actually being fixed


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

* [Bug libstdc++/46207] std::atomic<const T *>::store(...) fails to compile
  2010-10-28  5:35 [Bug libstdc++/46207] New: std::atomic<const T *>::store(...) fails to compile miles at gnu dot org
                   ` (5 preceding siblings ...)
  2010-10-28 11:11 ` redi at gcc dot gnu.org
@ 2010-10-29 11:09 ` paolo.carlini at oracle dot com
  2010-10-29 22:57 ` bkoz at gcc dot gnu.org
  2011-02-17  1:55 ` paolo.carlini at oracle dot com
  8 siblings, 0 replies; 10+ messages in thread
From: paolo.carlini at oracle dot com @ 2010-10-29 11:09 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46207

--- Comment #7 from Paolo Carlini <paolo.carlini at oracle dot com> 2010-10-29 11:09:25 UTC ---
So this is part of
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3164.html


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

* [Bug libstdc++/46207] std::atomic<const T *>::store(...) fails to compile
  2010-10-28  5:35 [Bug libstdc++/46207] New: std::atomic<const T *>::store(...) fails to compile miles at gnu dot org
                   ` (6 preceding siblings ...)
  2010-10-29 11:09 ` paolo.carlini at oracle dot com
@ 2010-10-29 22:57 ` bkoz at gcc dot gnu.org
  2011-02-17  1:55 ` paolo.carlini at oracle dot com
  8 siblings, 0 replies; 10+ messages in thread
From: bkoz at gcc dot gnu.org @ 2010-10-29 22:57 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46207

Benjamin Kosnik <bkoz at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bkoz at gcc dot gnu.org

--- Comment #8 from Benjamin Kosnik <bkoz at gcc dot gnu.org> 2010-10-29 22:57:35 UTC ---
yes, exactly. The updates for <atomic> are on the constexpr branch. Even this
will have to be updated for this paper, but it's much closer.


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

* [Bug libstdc++/46207] std::atomic<const T *>::store(...) fails to compile
  2010-10-28  5:35 [Bug libstdc++/46207] New: std::atomic<const T *>::store(...) fails to compile miles at gnu dot org
                   ` (7 preceding siblings ...)
  2010-10-29 22:57 ` bkoz at gcc dot gnu.org
@ 2011-02-17  1:55 ` paolo.carlini at oracle dot com
  8 siblings, 0 replies; 10+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-02-17  1:55 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46207

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.6.0

--- Comment #9 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-02-17 01:49:59 UTC ---
atomic_address is gone, this works fine now!


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

end of thread, other threads:[~2011-02-17  1:50 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-28  5:35 [Bug libstdc++/46207] New: std::atomic<const T *>::store(...) fails to compile miles at gnu dot org
2010-10-28  9:32 ` [Bug libstdc++/46207] " paolo.carlini at oracle dot com
2010-10-28  9:50 ` paolo.carlini at oracle dot com
2010-10-28  9:54 ` redi at gcc dot gnu.org
2010-10-28  9:59 ` paolo.carlini at oracle dot com
2010-10-28 10:14 ` paolo.carlini at oracle dot com
2010-10-28 11:11 ` redi at gcc dot gnu.org
2010-10-29 11:09 ` paolo.carlini at oracle dot com
2010-10-29 22:57 ` bkoz at gcc dot gnu.org
2011-02-17  1:55 ` 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).