capstone-engine / capstone

Capstone disassembly/disassembler framework for ARM, ARM64 (ARMv8), Alpha, BPF, Ethereum VM, HPPA, LoongArch, M68K, M680X, Mips, MOS65XX, PPC, RISC-V(rv32G/rv64G), SH, Sparc, SystemZ, TMS320C64X, TriCore, Webassembly, XCore and X86.
http://www.capstone-engine.org
7.61k stars 1.56k forks source link

Fix type punning in `AArch64_AM_isSVEMaskOfIdenticalElements` #2237

Closed kazarmy closed 10 months ago

kazarmy commented 10 months ago

This is a minor edit that fixes the type punning in AArch64_AM_isSVEMaskOfIdenticalElements which violates C strict aliasing rules and isn't compatible with gcc optimization level -O2, as seen in rizinorg/rizin#4048. A workaround is to use -fno-strict-aliasing but it would better if that flag isn't needed. This fix has been tested in rizinorg/rizin#4080 and it appears to have compiler support generally.

I plan to fix the translator after this, after I find out how the translator actually works.

kabeor commented 10 months ago

Thank You! Merged.