aco: Fix -Wstringop-overflow warnings in aco_span.
authorTimur Kristóf <timur.kristof@gmail.com>
Tue, 21 Jan 2020 12:43:13 +0000 (13:43 +0100)
committerTimur Kristóf <timur.kristof@gmail.com>
Wed, 22 Jan 2020 10:09:10 +0000 (11:09 +0100)
GCC does not understand how aco_span works.
This patch fixes it by casting the aco_span's this pointer
to uintptr_t rather than to a char pointer, effectively
telling GCC not to try to figure it out.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3483>

src/amd/compiler/aco_util.h

index 8d4c4d390f016259783eb0f01ddc8d8b741225b0..b04eaba55a11f50c1f21fc507ee9d7701bdecefc 100644 (file)
@@ -65,14 +65,14 @@ public:
    *   \return                data
    */
    constexpr iterator begin() noexcept {
-      return (pointer)((char*)this + offset);
+      return (pointer)((uintptr_t)this + offset);
    }
 
    /*! \brief                 Returns a const_iterator to the begin of the span
    *   \return                data
    */
    constexpr const_iterator begin() const noexcept {
-      return (const_pointer)((const char *)this + offset);
+      return (const_pointer)((uintptr_t)this + offset);
    }
 
    /*! \brief                 Returns an iterator to the end of the span