public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/95282] New: atomic<floating-point>::load in C++20 calls __atomic_load with a pointer-to-const as the output
@ 2020-05-23  4:33 rs2740 at gmail dot com
  2020-05-23  6:11 ` [Bug libstdc++/95282] " redi at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: rs2740 at gmail dot com @ 2020-05-23  4:33 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95282

            Bug ID: 95282
           Summary: atomic<floating-point>::load in C++20 calls
                    __atomic_load with a pointer-to-const as the output
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rs2740 at gmail dot com
  Target Milestone: ---

We have

      _Fp
      load(memory_order __m = memory_order_seq_cst) const noexcept
      { return __atomic_impl::load(&_M_fp, __m); }

which calls

    template<typename _Tp>
      _GLIBCXX_ALWAYS_INLINE _Tp
      load(_Tp* __ptr, memory_order __m) noexcept
      {
        alignas(_Tp) unsigned char __buf[sizeof(_Tp)];
        _Tp* __dest = reinterpret_cast<_Tp*>(__buf);
        __atomic_load(__ptr, __dest, int(__m));
        return *__dest;
      }

Here &_M_fp is a const _Fp*, so _Tp is const-qualified. GCC's __atomic_load
appears to happily tolerate a pointer-to-const dest (which seems rather
dubious), but Clang's doesn't.

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

end of thread, other threads:[~2020-07-01 22:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-23  4:33 [Bug libstdc++/95282] New: atomic<floating-point>::load in C++20 calls __atomic_load with a pointer-to-const as the output rs2740 at gmail dot com
2020-05-23  6:11 ` [Bug libstdc++/95282] " redi at gcc dot gnu.org
2020-05-27 22:10 ` redi at gcc dot gnu.org
2020-05-27 22:10 ` cvs-commit at gcc dot gnu.org
2020-06-16 21:35 ` cvs-commit at gcc dot gnu.org
2020-07-01 22:48 ` cvs-commit at gcc dot gnu.org
2020-07-01 22:49 ` 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).