From 4de31ccc9ef47e7b16330d226d071d5d006faa6d Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sat, 7 Mar 2020 22:02:35 +0200 Subject: libcamera: controls: Fix strict aliasing violation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit gcc 8.3.0 for ARM complains about strict aliasing violations: ../../src/libcamera/controls.cpp: In member function ‘void libcamera::ControlValue::release()’: ../../src/libcamera/controls.cpp:111:13: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] delete[] *reinterpret_cast(&storage_); Fix it and simplify the code at the same time. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- include/libcamera/controls.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h index 4767e2d3..0e111ab7 100644 --- a/include/libcamera/controls.h +++ b/include/libcamera/controls.h @@ -160,7 +160,10 @@ private: ControlType type_ : 8; bool isArray_ : 1; std::size_t numElements_ : 16; - uint64_t storage_; + union { + uint64_t value_; + void *storage_; + }; void release(); void set(ControlType type, bool isArray, const void *data, -- cgit v1.2.1