public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/49445] New: Undefined reference to std::atomic<float> "operator float"
@ 2011-06-16 20:22 raskolnikov at gnu dot org
  2011-06-17  9:04 ` [Bug libstdc++/49445] " rguenth at gcc dot gnu.org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: raskolnikov at gnu dot org @ 2011-06-16 20:22 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: Undefined reference to std::atomic<float> "operator
                    float"
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: raskolnikov@gnu.org


Hello,

It looks like std::atomic<float> does is not fully implemented. I get an
undefined reference to its operator float:

libtool: link: g++ -Wall -I/usr/include -I../../src -I../../src -g -O2
-std=c++0x -DNDEBUG -o .libs/psynth_unit_test
psynth_unit_test-psynth_unit_test.o [... a big list of object files ...]
-L/usr/lib64 -lboost_unit_test_framework-mt -lboost_filesystem-mt
-lboost_signals-mt -lboost_system-mt ../psynth/.libs/libpsynth.so -Wl,-rpath
-Wl,/home/raskolnikov/usr/lib

../psynth/.libs/libpsynth.so: undefined reference to 
   `atomic<float>::operator float() const'

A similar bug happened when I tried std::atomic<my_enum> with "my_enum" being a
"enum class my_enum : int", I got an undefined reference to the "store ()"
method instead.

I am using GCC 4.6 as included in Debian Sid:

  g++ --version
  g++ (Debian 4.6.0-13) 4.6.1 20110611 (prerelease)

  apt-cache show libstdc++6-4.6-dev
  Package: libstdc++6-4.6-dev
  Source: gcc-4.6
  Version: 4.6.0-13

Anyways, thanks a lot for your hard work implementing C++11 :)

JP


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

* [Bug libstdc++/49445] Undefined reference to std::atomic<float> "operator float"
  2011-06-16 20:22 [Bug libstdc++/49445] New: Undefined reference to std::atomic<float> "operator float" raskolnikov at gnu dot org
@ 2011-06-17  9:04 ` rguenth at gcc dot gnu.org
  2011-06-17  9:35 ` raskolnikov at gnu dot org
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-06-17  9:04 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2011.06.17 09:04:32
     Ever Confirmed|0                           |1

--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-06-17 09:04:32 UTC ---
Testcase?


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

* [Bug libstdc++/49445] Undefined reference to std::atomic<float> "operator float"
  2011-06-16 20:22 [Bug libstdc++/49445] New: Undefined reference to std::atomic<float> "operator float" raskolnikov at gnu dot org
  2011-06-17  9:04 ` [Bug libstdc++/49445] " rguenth at gcc dot gnu.org
@ 2011-06-17  9:35 ` raskolnikov at gnu dot org
  2011-06-17 11:43 ` marc.glisse at normalesup dot org
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: raskolnikov at gnu dot org @ 2011-06-17  9:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Juan Pedro Bolívar Puente <raskolnikov at gnu dot org> 2011-06-17 09:35:29 UTC ---
Created attachment 24553
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24553
Test case for the "undefined reference" on atom<float> bug

raskolnikov@nexus9:~$ make CXXFLAGS=-std=c++0x test_atom
g++ -std=c++0x    test_atom.cpp   -o test_atom
/tmp/ccS68VP3.o: In function `main':
test_atom.cpp:(.text+0x18): undefined reference to
`std::atomic<float>::operator float() const'
collect2: ld returned 1 exit status
make: *** [test_atom] Error 1


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

* [Bug libstdc++/49445] Undefined reference to std::atomic<float> "operator float"
  2011-06-16 20:22 [Bug libstdc++/49445] New: Undefined reference to std::atomic<float> "operator float" raskolnikov at gnu dot org
  2011-06-17  9:04 ` [Bug libstdc++/49445] " rguenth at gcc dot gnu.org
  2011-06-17  9:35 ` raskolnikov at gnu dot org
@ 2011-06-17 11:43 ` marc.glisse at normalesup dot org
  2011-06-17 12:08 ` marc.glisse at normalesup dot org
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: marc.glisse at normalesup dot org @ 2011-06-17 11:43 UTC (permalink / raw)
  To: gcc-bugs

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

Marc Glisse <marc.glisse at normalesup dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |marc.glisse at normalesup
                   |                            |dot org

--- Comment #3 from Marc Glisse <marc.glisse at normalesup dot org> 2011-06-17 11:43:16 UTC ---
It looks like C++11 only defines atomic<integral> and atomic<T*>, so a
link-time error on atomic<float> seems ok, no?


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

* [Bug libstdc++/49445] Undefined reference to std::atomic<float> "operator float"
  2011-06-16 20:22 [Bug libstdc++/49445] New: Undefined reference to std::atomic<float> "operator float" raskolnikov at gnu dot org
                   ` (2 preceding siblings ...)
  2011-06-17 11:43 ` marc.glisse at normalesup dot org
@ 2011-06-17 12:08 ` marc.glisse at normalesup dot org
  2011-06-17 14:41 ` raskolnikov at gnu dot org
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: marc.glisse at normalesup dot org @ 2011-06-17 12:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Marc Glisse <marc.glisse at normalesup dot org> 2011-06-17 12:07:53 UTC ---
(In reply to comment #3)
> It looks like C++11 only defines atomic<integral> and atomic<T*>, so a
> link-time error on atomic<float> seems ok, no?

Sorry, please ignore the above comment, I should have read the standard
properly before posting.


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

* [Bug libstdc++/49445] Undefined reference to std::atomic<float> "operator float"
  2011-06-16 20:22 [Bug libstdc++/49445] New: Undefined reference to std::atomic<float> "operator float" raskolnikov at gnu dot org
                   ` (3 preceding siblings ...)
  2011-06-17 12:08 ` marc.glisse at normalesup dot org
@ 2011-06-17 14:41 ` raskolnikov at gnu dot org
  2011-06-26  8:37 ` indi.in.the.wired at gmail dot com
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: raskolnikov at gnu dot org @ 2011-06-17 14:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Juan Pedro Bolívar Puente <raskolnikov at gnu dot org> 2011-06-17 14:41:03 UTC ---
You are right, I thought it worked for all fundamental types but reviewing the
proposal [1] makes me realise I was wrong. It remains unclear wether user
defined enums should work ...

Thanks a lot for the fast reply and sorry for the mistake.

[1] http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2427.html


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

* [Bug libstdc++/49445] Undefined reference to std::atomic<float> "operator float"
  2011-06-16 20:22 [Bug libstdc++/49445] New: Undefined reference to std::atomic<float> "operator float" raskolnikov at gnu dot org
                   ` (4 preceding siblings ...)
  2011-06-17 14:41 ` raskolnikov at gnu dot org
@ 2011-06-26  8:37 ` indi.in.the.wired at gmail dot com
  2011-06-26 14:07 ` redi at gcc dot gnu.org
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: indi.in.the.wired at gmail dot com @ 2011-06-26  8:37 UTC (permalink / raw)
  To: gcc-bugs

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

Mark A. Gibbs <indi.in.the.wired at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |indi.in.the.wired at gmail
                   |                            |dot com

--- Comment #6 from Mark A. Gibbs <indi.in.the.wired at gmail dot com> 2011-06-26 08:37:09 UTC ---
(In reply to comment #5)
> You are right, I thought it worked for all fundamental types but reviewing the
> proposal [1] makes me realise I was wrong. It remains unclear wether user
> defined enums should work ...

According to 29.5.1 in the draft standard i have (n3242):
"There is a generic class template atomic<T>. The type of the template argument
T shall be trivially copyable (3.9)."
That wording is in several older drafts, too, going back to at least March
2010, so it's not new and probably won't change.

So it *should* work for all fundamental types, and even user-defined types
(classes) provided they're trivially copyable. Both float and scoped enums are
trivially copyable, so atomic<float> and atomic<some_enum_class_type> should
work.

What the standard says about integral types is just that specializations
already exist for them (like specialization atomic<int> exists, and publicly
inherits from atomic_int).


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

* [Bug libstdc++/49445] Undefined reference to std::atomic<float> "operator float"
  2011-06-16 20:22 [Bug libstdc++/49445] New: Undefined reference to std::atomic<float> "operator float" raskolnikov at gnu dot org
                   ` (5 preceding siblings ...)
  2011-06-26  8:37 ` indi.in.the.wired at gmail dot com
@ 2011-06-26 14:07 ` redi at gcc dot gnu.org
  2012-02-03 20:20 ` [Bug libstdc++/49445] [C++0x] " bkoz at gcc dot gnu.org
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: redi at gcc dot gnu.org @ 2011-06-26 14:07 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW
           Severity|major                       |normal

--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-06-26 14:06:49 UTC ---
Yup, it should work, but it's not fully implemented yet

Severity is not "major" though, it's a missing feature in the experimental
C++0x mode, let's not pretend it's a serious problem for anyone.


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

* [Bug libstdc++/49445] [C++0x] Undefined reference to std::atomic<float> "operator float"
  2011-06-16 20:22 [Bug libstdc++/49445] New: Undefined reference to std::atomic<float> "operator float" raskolnikov at gnu dot org
                   ` (6 preceding siblings ...)
  2011-06-26 14:07 ` redi at gcc dot gnu.org
@ 2012-02-03 20:20 ` bkoz at gcc dot gnu.org
  2012-02-03 20:29 ` bkoz at gcc dot gnu.org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: bkoz at gcc dot gnu.org @ 2012-02-03 20:20 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 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

--- Comment #8 from Benjamin Kosnik <bkoz at gcc dot gnu.org> 2012-02-03 20:19:48 UTC ---
Mine


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

* [Bug libstdc++/49445] [C++0x] Undefined reference to std::atomic<float> "operator float"
  2011-06-16 20:22 [Bug libstdc++/49445] New: Undefined reference to std::atomic<float> "operator float" raskolnikov at gnu dot org
                   ` (7 preceding siblings ...)
  2012-02-03 20:20 ` [Bug libstdc++/49445] [C++0x] " bkoz at gcc dot gnu.org
@ 2012-02-03 20:29 ` bkoz at gcc dot gnu.org
  2012-02-03 21:11 ` bkoz at gcc dot gnu.org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: bkoz at gcc dot gnu.org @ 2012-02-03 20:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Benjamin Kosnik <bkoz at gcc dot gnu.org> 2012-02-03 20:28:29 UTC ---

This is no longer present on 4.7.x branch. I'm going to add this test case in
any case.


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

* [Bug libstdc++/49445] [C++0x] Undefined reference to std::atomic<float> "operator float"
  2011-06-16 20:22 [Bug libstdc++/49445] New: Undefined reference to std::atomic<float> "operator float" raskolnikov at gnu dot org
                   ` (8 preceding siblings ...)
  2012-02-03 20:29 ` bkoz at gcc dot gnu.org
@ 2012-02-03 21:11 ` bkoz at gcc dot gnu.org
  2012-02-16 20:41 ` bkoz at gcc dot gnu.org
  2012-07-09 14:14 ` redi at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: bkoz at gcc dot gnu.org @ 2012-02-03 21:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Benjamin Kosnik <bkoz at gcc dot gnu.org> 2012-02-03 21:10:06 UTC ---
Author: bkoz
Date: Fri Feb  3 21:10:00 2012
New Revision: 183878

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=183878
Log:
2012-02-03  Benjamin Kosnik  <bkoz@redhat.com>

    PR libstdc++/49445

Added:
    trunk/libstdc++-v3/testsuite/29_atomics/atomic/cons/49445.cc
Modified:
    trunk/libstdc++-v3/ChangeLog


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

* [Bug libstdc++/49445] [C++0x] Undefined reference to std::atomic<float> "operator float"
  2011-06-16 20:22 [Bug libstdc++/49445] New: Undefined reference to std::atomic<float> "operator float" raskolnikov at gnu dot org
                   ` (9 preceding siblings ...)
  2012-02-03 21:11 ` bkoz at gcc dot gnu.org
@ 2012-02-16 20:41 ` bkoz at gcc dot gnu.org
  2012-07-09 14:14 ` redi at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: bkoz at gcc dot gnu.org @ 2012-02-16 20:41 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

--- Comment #11 from Benjamin Kosnik <bkoz at gcc dot gnu.org> 2012-02-16 20:12:41 UTC ---

Fixed in 4.7


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

* [Bug libstdc++/49445] [C++0x] Undefined reference to std::atomic<float> "operator float"
  2011-06-16 20:22 [Bug libstdc++/49445] New: Undefined reference to std::atomic<float> "operator float" raskolnikov at gnu dot org
                   ` (10 preceding siblings ...)
  2012-02-16 20:41 ` bkoz at gcc dot gnu.org
@ 2012-07-09 14:14 ` redi at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: redi at gcc dot gnu.org @ 2012-07-09 14:14 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nnelson at infowest dot com

--- Comment #12 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-07-09 14:13:12 UTC ---
*** Bug 53899 has been marked as a duplicate of this bug. ***


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

end of thread, other threads:[~2012-07-09 14:14 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-16 20:22 [Bug libstdc++/49445] New: Undefined reference to std::atomic<float> "operator float" raskolnikov at gnu dot org
2011-06-17  9:04 ` [Bug libstdc++/49445] " rguenth at gcc dot gnu.org
2011-06-17  9:35 ` raskolnikov at gnu dot org
2011-06-17 11:43 ` marc.glisse at normalesup dot org
2011-06-17 12:08 ` marc.glisse at normalesup dot org
2011-06-17 14:41 ` raskolnikov at gnu dot org
2011-06-26  8:37 ` indi.in.the.wired at gmail dot com
2011-06-26 14:07 ` redi at gcc dot gnu.org
2012-02-03 20:20 ` [Bug libstdc++/49445] [C++0x] " bkoz at gcc dot gnu.org
2012-02-03 20:29 ` bkoz at gcc dot gnu.org
2012-02-03 21:11 ` bkoz at gcc dot gnu.org
2012-02-16 20:41 ` bkoz at gcc dot gnu.org
2012-07-09 14:14 ` redi 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).