CharLS is cross-platform. -Wcast-align=strict will always warn for alignment issues, even when current platform can handle it (for example x86) Use void*+static_cast to increase alignment. This is safe for dynamic allocated memory.