Bug 52929 - use of undeclared identifier '__ATOMIC_ACQ_REL'
Summary: use of undeclared identifier '__ATOMIC_ACQ_REL'
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.7.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-10 18:45 UTC by Ben
Modified: 2012-04-11 15:42 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2012-04-10 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ben 2012-04-10 18:45:53 UTC
The error occurs on Archlinux x64 with everything updated.
The project uses Qt 4.8.x which was installed using the package manager. I also tried compiling with clang, which came up with the same error.

The following error breaks the compile:

In file included from /usr/include/QtCore/qstring.h:54:
In file included from /usr/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/string:53:
In file included from /usr/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/bits/basic_string.h:40:
/usr/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/ext/atomicity.h:48:45: error:
      use of undeclared identifier '__ATOMIC_ACQ_REL'
  { return __atomic_fetch_add(__mem, __val, __ATOMIC_ACQ_REL); }
                                            ^
/usr/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/ext/atomicity.h:52:38: error:
      use of undeclared identifier '__ATOMIC_ACQ_REL'
  { __atomic_fetch_add(__mem, __val, __ATOMIC_ACQ_REL); }
                                     ^
2 errors generated.
make[1]: *** [../bin/debug/obj/main.o] Error 1
make[1]: Leaving directory `/tmp/qirk/src'
make: *** [sub-src-make_default-ordered] Error 2

I also tried to find the define using grep:

# grep -r __ATOMIC_ACQ_REL /usr/include/
/usr/include/c++/4.7.0/bits/shared_ptr_base.h:					  true, __ATOMIC_ACQ_REL, 
/usr/include/c++/4.7.0/ext/atomicity.h:  { return __atomic_fetch_add(__mem, __val, __ATOMIC_ACQ_REL); }
/usr/include/c++/4.7.0/ext/atomicity.h:  { __atomic_fetch_add(__mem, __val, __ATOMIC_ACQ_REL); }
/usr/include/c++/4.7.0/profile/impl/profiler_state.h:				       &inv, __s, false, __ATOMIC_ACQ_REL, 
/usr/include/c++/4.7.0/parallel/compatibility.h:    return __atomic_fetch_add(__ptr, __addend, __ATOMIC_ACQ_REL);
/usr/include/c++/4.7.0/parallel/compatibility.h:    return __atomic_fetch_add(__ptr, __addend, __ATOMIC_ACQ_REL);
/usr/include/c++/4.7.0/parallel/compatibility.h:    return __atomic_fetch_add(__ptr, __addend, __ATOMIC_ACQ_REL);
/usr/include/c++/4.7.0/parallel/compatibility.h:				       false, __ATOMIC_ACQ_REL,
/usr/include/c++/4.7.0/parallel/compatibility.h:				       false, __ATOMIC_ACQ_REL,
/usr/include/c++/4.7.0/parallel/compatibility.h:				       false, __ATOMIC_ACQ_REL,
/usr/include/c++/4.7.0/tr1/shared_ptr.h:					  true, __ATOMIC_ACQ_REL, 

Greetings
Ben
Comment 1 ncahill_alt 2012-04-10 18:54:51 UTC
Regarding this, I've found that __ATOMIC_ACQ_REL is new in 4.7.0, it is not used in any 4.6.x.  And also my source-built 4.7.0 is lacking a #define for this macro.

Neil.
Comment 2 Andrew Macleod 2012-04-10 20:18:01 UTC
It is built in to the C preprocessor as a predefined value in GCC 4.7  (see cppbuiltin.c), so you wouldn't find a specific #define anywhere.  

The __atomic built-ins don't work properly without at least a GCC 4.7 compiler, so you wouldn't be able to compile them properly with a different compiler.
Comment 3 Jonathan Wakely 2012-04-10 20:53:36 UTC
Please read http://gcc.gnu.org/bugs/ and provide the requested information.

Tell us what "gcc -v" shows, attach preprocessed source etc.
Comment 4 Ben 2012-04-11 15:18:16 UTC
System: Archlinux x64 / XFCE
IDE: QtCreator 2.4
Buildsystem: qmake
Used libraries: qt 4.6.x
Language: C++

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /build/src/gcc-4.7-20120407/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared --enable-threads=posix --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --enable-libstdcxx-time --enable-gnu-unique-object --enable-linker-build-id --with-ppl --enable-cloog-backend=isl --enable-lto --enable-gold --enable-ld=default --enable-plugin --with-plugin-ld=ld.gold --with-linker-hash-style=gnu --disable-multilib --disable-libssp --disable-build-with-cxx --disable-build-poststage1-with-cxx --enable-checking=release
Thread model: posix
gcc version 4.7.0 20120407 (prerelease) (GCC)

Sadly I'm unable to build the break again. I've installed gcc4.4 to be able to build the project again. But now even gcc4.7 is able to build it..

Anything I can do to help?

Ben
Comment 5 Jonathan Wakely 2012-04-11 15:42:51 UTC
It sounds as though you messed up your system somehow so that an older gcc (or older preprocessor) was using the headers from gcc 4.7, otherwise the error shouldn't be possible.  The fact it's disappeared after reinstalling something supports that hypothesis.

Closing as invalid, please re-open if you can reproduce it, or report it to Arch.

(In reply to comment #4)
> gcc version 4.7.0 20120407 (prerelease) (GCC)

I do wish Arch wouldn't fsck with the version string like that, 4.7.0 was already released prior to 20120407.