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

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(I wrote this before comment 4 was added ...)

What would the precise semantics of the suggested warning be? What kind of
expressions do you expect to warn, and which should not?

How would I suppress the warning if -x is exactly what I intended to write and
it does exactly what I expect? For example, the implementation of std::align
uses:

inline void*
align(size_t __align, size_t __size, void*& __ptr, size_t& __space) noexcept
{
  if (__space < __size)
    return nullptr;
  const auto __intptr = reinterpret_cast<uintptr_t>(__ptr);
  const auto __aligned = (__intptr - 1u + __align) & -__align;
  // ...

How would I prevent -__align from warning?

Reply via email to