310055e7b4
gcc: 2015-09-17 Richard Henderson <rth@redhat.com> PR libstdc++/65913 * builtins.c (fold_builtin_atomic_always_lock_free): Handle fake pointers that encode the alignment of the object. libstdc++-v3: 2015-09-17 Jonathan Wakely <jwakely@redhat.com> PR libstdc++/65913 * include/bits/atomic_base.h (__atomic_base<_TTp>::is_lock_free(), __atomic_base<_PTp*>::is_lock_free()): Call the built-in with the immediate pointer value, not a variable. * include/std/atomic (atomic<T>::is_lock_free()): Likewise. * testsuite/29_atomics/atomic/65913.cc: New. From-SVN: r227878
40 lines
1.1 KiB
C++
40 lines
1.1 KiB
C++
// Copyright (C) 2015 Free Software Foundation, Inc.
|
|
//
|
|
// This file is part of the GNU ISO C++ Library. This library is free
|
|
// software; you can redistribute it and/or modify it under the
|
|
// terms of the GNU General Public License as published by the
|
|
// Free Software Foundation; either version 3, or (at your option)
|
|
// any later version.
|
|
|
|
// This library is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU General Public License for more details.
|
|
|
|
// You should have received a copy of the GNU General Public License along
|
|
// with this library; see the file COPYING3. If not see
|
|
// <http://www.gnu.org/licenses/>.
|
|
|
|
// { dg-do run { target x86_64-*-linux* powerpc*-*-linux* } }
|
|
// { dg-options "-std=gnu++11 -O0" }
|
|
|
|
#include <atomic>
|
|
#include <testsuite_hooks.h>
|
|
|
|
// PR libstdc++/65913
|
|
|
|
void
|
|
test01()
|
|
{
|
|
struct Int { int i; };
|
|
VERIFY( std::atomic<Int>{}.is_lock_free() );
|
|
VERIFY( std::atomic<int>{}.is_lock_free() );
|
|
VERIFY( std::atomic<int*>{}.is_lock_free() );
|
|
}
|
|
|
|
int
|
|
main()
|
|
{
|
|
test01();
|
|
}
|