Mesa (master): aco: Fix -Wstringop-overflow warnings in aco_span.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jan 22 10:28:39 UTC 2020


Module: Mesa
Branch: master
Commit: 6fb3df2786f09f4c7383cb0a15d394316d240c42
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6fb3df2786f09f4c7383cb0a15d394316d240c42

Author: Timur Kristóf <timur.kristof at gmail.com>
Date:   Tue Jan 21 13:43:13 2020 +0100

aco: Fix -Wstringop-overflow warnings in aco_span.

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 at gmail.com>
Reviewed-by: Daniel Schürmann <daniel at schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3483>

---

 src/amd/compiler/aco_util.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/amd/compiler/aco_util.h b/src/amd/compiler/aco_util.h
index 8d4c4d390f0..b04eaba55a1 100644
--- a/src/amd/compiler/aco_util.h
+++ b/src/amd/compiler/aco_util.h
@@ -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



More information about the mesa-commit mailing list