public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/65083] New: Can not indirectly call some C11 atomic library functions
@ 2015-02-17 4:41 bin.x.fan at oracle dot com
2015-02-17 12:33 ` [Bug c/65083] " joseph at codesourcery dot com
0 siblings, 1 reply; 2+ messages in thread
From: bin.x.fan at oracle dot com @ 2015-02-17 4:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65083
Bug ID: 65083
Summary: Can not indirectly call some C11 atomic library
functions
Product: gcc
Version: 4.9.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: bin.x.fan at oracle dot com
C11 defines these as actual functions, not generic functions or macros:
atomic_thread_fence
atomic_signal_fence
atomic_flag_test_and_set
atomic_flag_test_and_set_explicit
atomic_flag_clear
atomic_flag_clear_explicit
User should be able to take their address and call them indirectly. However,
GCC does not provide definitions of these functions in libatomic.so, so GCC
does not allow the user to take the address of these functions.
Here is an example:
-bash-4.1$ gcc -v
Using built-in specs.
COLLECT_GCC=/net/dv104/export/tools/gcc/4.9.2/sparc-S2/bin/gcc.bin
COLLECT_LTO_WRAPPER=/net/dv104/export/tools/gcc/4.9.2/sparc-S2/libexec/gcc/sparc-sun-solaris2.10/4.9.2/lto-wrapper
Target: sparc-sun-solaris2.10
Configured with: ../gcc-4.9.2/configure
--prefix=/net/dv104/export/tools/gcc/4.9.2/sparc-S2
--enable-languages=c,c++,fortran
--with-gmp=/net/dv104/export/tools/gcc/4.9.2/sparc-S2
--with-mpfr=/net/dv104/export/tools/gcc/4.9.2/sparc-S2
--with-mpc=/net/dv104/export/tools/gcc/4.9.2/sparc-S2
Thread model: posix
gcc version 4.9.2 (GCC)
-bash-4.1$ cat t.c
#include <stdatomic.h>
void (*func_ptr) (memory_order order);
int main()
{
func_ptr = &atomic_thread_fence;
(*func_ptr)(memory_order_seq_cst);
return 0;
}
-bash-4.1$ gcc t.c -latomic
t.c: In function 'main':
t.c:5:15: error: 'atomic_thread_fence' undeclared (first use in this function)
func_ptr = &atomic_thread_fence;
^
t.c:5:15: note: each undeclared identifier is reported only once for each
function it appears in
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c/65083] Can not indirectly call some C11 atomic library functions
2015-02-17 4:41 [Bug c/65083] New: Can not indirectly call some C11 atomic library functions bin.x.fan at oracle dot com
@ 2015-02-17 12:33 ` joseph at codesourcery dot com
0 siblings, 0 replies; 2+ messages in thread
From: joseph at codesourcery dot com @ 2015-02-17 12:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65083
--- Comment #1 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
Presumably libatomic should get trivial wrappers for the macros, and
stdatomic.h should add corresponding function declarations.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-02-17 12:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-17 4:41 [Bug c/65083] New: Can not indirectly call some C11 atomic library functions bin.x.fan at oracle dot com
2015-02-17 12:33 ` [Bug c/65083] " joseph at codesourcery 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).