> On Dec 2, 2020, at 10:41, Andrey Rahmatullin <w...@debian.org> wrote:
> 
> As I've already told you yesterday on IRC, the test succeeds with -O2,
> which is set when building the package.

Furthermore you can actually see a variant of the problem with this test code 
even on non-MIPS:

    $ uname -m
    x86_64
    $ cat - >main.cc <http://main.cc/> <<EOT
    #include <atomic>
    int main(void) {
      // a fancy type that needs -mcx16
      struct Foo { unsigned __int128 x; };
      std::atomic<Foo> y;
      y.is_lock_free();
    }
    EOT
    $ g++ -std=c++11 main.cc <http://main.cc/>
    /tmp/h43jh.o: In function `std::atomic<main::Foo>::is_lock_free() const’:
    main.cc <http://main.cc/>:(text+0x57): undefined reference to 
`__atomic_is_lock_free’
    collect2: error: ld returned 1 exit status
    $ echo $?
    1
    $ g++ -O3 -std=c++11 main.cc <http://main.cc/>
    $ echo $?
    0

The compiler can see the atomic and its use are dead code and removes them.

Reply via email to